Skip to Content.
Sympa Menu

freetds - [freetds] hex(92), freeTDS and MS SQL

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Adam Prime x443" <aprime AT brunico.com>
  • To: <FreeTDS AT lists.ibiblio.org>
  • Cc:
  • Subject: [freetds] hex(92), freeTDS and MS SQL
  • Date: Wed, 27 Oct 2004 15:47:42 -0400

I'm not sure if the problem is freeTDS or not, but i though i'd try you guys
anyway.

I'm using Perl DBI, DBD::Sybase and freeTDS to connect to an MSSQL server.
most things work fine and dandy. however, when someone pastes a
"smart-quoted" quotation mark from word (hex92) into a field to put it into
the database, it gets changed into a question mark (hex63).

According to snort, it's actually sending a 92 down the line to the database,
but when it gets there
it's getting changed to a question mark. below is a dump from snort from an
update setting a field called Body (which is of type text) to '''*' (hex 92,
hex 91, hex 95). all three characters end up as question marks (?) in the
database.

TCP TTL:64 TOS:0x0 ID:48648 IpLen:20 DgmLen:242 DF
***AP*** Seq: 0x865CD160 Ack: 0x3658CBFC Win: 0x7C70 TcpLen: 32
TCP Options (3) => NOP NOP TS: 1512730503 51056234
01 01 00 BE 00 00 01 00 55 00 50 00 44 00 41 00 ........U.P.D.A.
54 00 45 00 20 00 20 00 20 00 20 00 64 00 62 00 T.E. . . . .d.b.
6F 00 2E 00 74 00 62 00 6C 00 50 00 65 00 6E 00 o...t.b.l.P.e.n.
64 00 69 00 6E 00 67 00 49 00 73 00 73 00 75 00 d.i.n.g.I.s.s.u.
65 00 42 00 6F 00 64 00 69 00 65 00 73 00 0D 00 e.B.o.d.i.e.s...
0A 00 53 00 45 00 54 00 20 00 20 00 20 00 20 00 ..S.E.T. . . . .
20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 . . . . . . . .
20 00 20 00 42 00 6F 00 64 00 79 00 20 00 3D 00 . .B.o.d.y. .=.
20 00 27 00 92 00 91 00 95 00 27 00 0D 00 0A 00 .'.......'.....
57 00 48 00 45 00 52 00 45 00 20 00 20 00 20 00 W.H.E.R.E. . . .
20 00 20 00 28 00 42 00 6F 00 64 00 79 00 49 00 . .(.B.o.d.y.I.
44 00 20 00 3D 00 20 00 31 00 34 00 29 00 D. .=. .1.4.).

This is the SQL i'm using:

my $query = "UPDATE dbo.tblPendingIssueBodies
SET Body = '''*'
WHERE (BodyID = 14)";

I think this may be related to charsets, but i'm at a loss on how to fix it.
If i run the query above in Enterprise manager the characters get put into
the database as they should be, the problem only occurs when inserting from
linux using freetds.

Any help would be appreciated.




Archive powered by MHonArc 2.6.24.

Top of Page