freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Eddie Gieze <egieze AT techno-design.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] UTF-8 conversion
- Date: Fri, 22 Apr 2005 21:01:07 +0200
Ok, manually i get this:
1> select content, cast(cast(content as nvarchar(40)) as varbinary(40)) as HexContent FROM tblitem WHERE id = 1317
2> go
content HexContent
Msg 2403, Level 16, State 0, Server OpenClient, Line 0
WARNING! Some character(s) could not be converted into client's character set. Unconverted bytes were changed to question marks ('?').
t????t 7400c4001c20c500a0007400
And the command gives me this:
00000000 6c 6f 63 61 6c 65 20 69 73 20 22 43 22 0a 6c 6f |locale is "C".lo|
00000010 63 61 6c 65 20 63 68 61 72 73 65 74 20 69 73 20 |cale charset is |
00000020 22 55 53 2d 41 53 43 49 49 22 0a 31 3e 20 32 3e |"US-ASCII".1> 2>|
00000030 20 31 3e 20 32 3e 20 | 1> 2> |
00000037
I think it's not selecting the right database..
What i find strange about the hexcontent is that it uses 8 bytes for two characters.. and it's translated into 4 question marks. I'm puzzled. My guess is i'm requesting the data in a wrong format from the server? I'm requesting it as SQL_C_CHAR in my program.
Grtz,
Eddie Gieze
On Apr 22, 2005, at 8:33 PM, Lowden, James K wrote:
From: Eddie Gieze
Sent: Friday, April 22, 2005 1:45 PM
On Apr 22, 2005, at 7:16 PM, Lowden, James K wrote:
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
Hello James,
1> select content, cast(content as varbinary(40)) as HexContent from
tblitem where id = 1317
2> go
Msg 529, Level 16, State 2, Server EDDIEXP\MSDE2000, Line 1
Explicit conversion from data type ntext to varbinary is not allowed.
Oh, well, oops. Just convert it twice.
$ printf '%s\ngo\n' \
'SELECT name,
content,
cast(cast(content as nvarchar(40)) as varbinary(40)) as
HexContent
FROM tblite m WHERE id = 1317' \
| tsql -S$S -U$U -P$P | hexdump -C
The idea is to let the server show you its own hexdump, if you will.
Example:
$ tsql -S$S -U$U -P$P
locale is "C"
locale charset is "646"
1> select N'hello', cast(N'hello' as varbinary(40))
2> go
hello 680065006c006c006f00
--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.
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
-
[freetds] UTF-8 conversion,
Eddie Gieze, 04/21/2005
- <Possible follow-up(s)>
-
RE: [freetds] UTF-8 conversion,
Lowden, James K, 04/21/2005
- Re: [freetds] UTF-8 conversion, Eddie Gieze, 04/22/2005
-
RE: [freetds] UTF-8 conversion,
Lowden, James K, 04/22/2005
- Re: [freetds] UTF-8 conversion, Eddie Gieze, 04/22/2005
- RE: [freetds] UTF-8 conversion, Frediano Ziglio, 04/22/2005
- RE: [freetds] UTF-8 conversion, Frediano Ziglio, 04/22/2005
-
RE: [freetds] UTF-8 conversion,
Lowden, James K, 04/22/2005
-
Re: [freetds] UTF-8 conversion,
Eddie Gieze, 04/22/2005
- Re: [freetds] UTF-8 conversion, James K. Lowden, 04/22/2005
-
Re: [freetds] UTF-8 conversion,
Eddie Gieze, 04/22/2005
Archive powered by MHonArc 2.6.24.