Skip to Content.
Sympa Menu

freetds - RE: [freetds] UTF-8 conversion

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] UTF-8 conversion
  • Date: Fri, 22 Apr 2005 13:16:03 -0400

> From: Eddie Gieze
> Sent: Friday, April 22, 2005 10:26 AM

Hi Eddie,

I was able to reproduce your libiconv tests. I think we can rule out
your iconv library. However, the TDSDUMP you provided doesn't (afaict)
square with the inputs you say you're expecting.

> Data i should be getting:
>
> 74 C4 93 C5 A0 74 00 OS X character palette - utf-8
> 0074 0113 0160 0074 OS X character palette -
unicode
>
> Data i'm getting:
>
> 74 C3 84 E2 80 9C C3 85 C2 A0 74 00 XCode - SQLGetData
> 74 C3 84 E2 80 9C C3 85 C2 A0 74 00 XCode - SQLBindCol

Here's the data packet:

0040 d1 07 00-6f 6e 65 63 68 61 72 10 |.n.t.... onechar.|
0050 fd ff 7d dd 00 00 00 00-cc 0a 00 00 01 00 0c 00 |..}..... ........|
0060 64 75 6d 6d 79 54 53 00-0c 00 00 00 74 00 c4 00 |dummyTS. ....t...|
0070 1c 20 c5 00 a0 00 74 00

I'm having some trouble parsing it. There seem to be two rows, but I
find only one ROW token:

row token d1
col 0 is 7 bytes 07 00
data ("onechar") 6f 6e 65 63 68 61 72

???
10 fd ff 7d dd 00 00 00 00 cc 0a 00 00 01 00 0c 00

data ("dummyTS") 64 75 6d 6d 79 54 53
locale 00

col 1 is 12 bytes 0c 00 00 00
data 74 00 c4 00 1c 20 c5 00 a0 00 74 00
DONE packet fd 10 00 c1 00 01 00 00 00

But in any case, that last packet is certainly not '0074 0113 0160
0074'. Converting it yields what you're getting:

$ perl -e'print qq(\x74\x00\xc4\x00\x1c\x20\xc5\x00\xa0\x00\x74\x00)' \
> | iconv -f ucs-2le -t utf-8 | hexdump -C
00000000 74 c3 84 e2 80 9c c3 85 c2 a0 74
|t.........t|

*Maybe* token.c is misparsing the packet, but I think it's more likely
you're not getting from the server what you think you're getting.

To confirm, this might be an interesting test:

$ printf '%s\ngo\n' \
'SELECT name,
content,
cast(content as varbinary(40)) as HexContent
FROM tblite m WHERE id = 1317' \
| tsql -S$S -U$U -P$P | hexdump -C

HTH.

--jkl


-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named
above. If you are not the intended recipient, or an employee or agent
responsible
for delivering this message to the intended recipient, any review,
dissemination,
distribution or duplication of this communication is strictly prohibited. If
you are
not the intended recipient, please contact the sender immediately by reply
e-mail
and destroy all copies of the original message. Please note that we do not
accept
account orders and/or instructions by e-mail, and therefore will not be
responsible
for carrying out such orders and/or instructions. If you, as the intended
recipient
of this message, the purpose of which is to inform and update our clients,
prospects
and consultants of developments relating to our services and products, would
not
like to receive further e-mail correspondence from the sender, please "reply"
to the
sender indicating your wishes. In the U.S.: 1345 Avenue of the Americas, New
York,
NY 10105.




Archive powered by MHonArc 2.6.24.

Top of Page