[freetds] Character set problem

Hannu Niemi hannu at listserv.kuntaliitto.fi
Thu Sep 16 01:38:54 EDT 2004


On 15 Sep 2004 at 11:59, Lowden, James K wrote:

> -----Original Message-----
> From: Hannu Niemi
> Sent: Wednesday, September 15, 2004 5:12 AM
> 
> In short, the problem is our national characters (with umlauts) that
> are converted to question marks (in SELECT queries at least). When
> debugging for example 'a umlaut' is hex 84 (CP850?). The server
> collation is SQL_Scandinavian_CP850_CI_AS. ---End Original Message---
> 
> Hej Hannu! 
> 
> I assume you're using TDS 0.62 or later.  

TDS 0.62.4, so your assumption holds.
> 
> Show us your freetds.conf and a short TDSDUMP log, just to make sure
> things are set up right.  It would be good if the log included a query
> with a failed conversion.  

freetds.conf:
apps:/etc/freetds # cat freetds.conf

#   $Id: freetds.conf,v 1.9 2003/12/04 22:26:55 freddy77 Exp $
#
# Global settings, any value here may be overridden by a database
# server specific section
[global]
        # TDS protocol version
        tds version = 4.2

;       initial block size = 512

        # uses some fixes required for some bugged MSSQL 7.0 server 
that
        # return invalid data to big endian clients
        # NOTE TDS version 7.0 or 8.0 should be used instead
;       swap broken dates = no
;       swap broken money = no

        # Database server login method, if both server and domain
        # logins are enabled, domain login is tried first if a domain
        # is specified, and if that fails the server login will be 
used.
        # OBSOLETE
        try server login = yes
;       try domain login = no

        # The default authentication domain, can be overridden by
        # specifying a username with a domain prefix, e.g. 
DOMAIN\username
        # OBSOLETE use DOMAIN\username as username
;       nt domain = WORKGROUP

        # If the server responds with different domain try that one?
        # OBSOLETE never been used
;       cross domain login = no

        # Whether to write a TDSDUMP file for diagnostic purposes
        # (setting this to /tmp is insecure on a multi-user system)
        dump file = /var/log/freetds.log
;       debug level = 10

        # Command and connection timeouts
;       timeout = 10
;       connect timeout = 10

        # If you get out of memory errors, it may mean that your 
client
        # is trying to allocate a huge buffer for a TEXT field.
        # (Microsoft servers sometimes pretend TEXT columns are
        # 4 GB wide!)   If you have this problem, try setting
        # 'text size' to a more reasonable limit
        text size = 64512

[mypool]
        host = 127.0.0.1
        port = 5000
        tds version = 4.2

# A typical Microsoft SQL Server 2000 configuration
[MyServer2k]
        host = 192.168.1.33
        port = 1433
        dump file=/var/log/freetds.log
        tds version = 8.0


Dumplog:

Starting log file for FreeTDS 0.62.4
        on 2004-09-16 08:30:53 with debug level 99.
names for ISO-8859-1: ISO-8859-1
names for UTF-8: UTF-8
names for UCS-2LE: UCS-2LE
names for UCS-2BE: UCS-2BE
iconv to convert client-side data to the "ISO-8859-1" character set
08:30:53.296553 tds_iconv_info_init: converting "ISO-8859-1"->"UCS-
2LE"
08:30:53.296590 tds_iconv_info_init: converting "ISO-8859-1"->"UCS-
2LE"
08:30:53.296605 Connecting to 192.168.1.33 port 1433, TDS 8.0.
08:30:53.296990 tds_put_string converting 4 bytes of "apps"
08:30:53.297020 tds_put_string wrote 8 bytes
08:30:53.297029 tds_put_string converting 2 bytes of "sa"
08:30:53.297038 tds_put_string wrote 4 bytes
08:30:53.297048 tds_put_string converting 4 bytes of "TSQL"
08:30:53.297058 tds_put_string wrote 8 bytes
08:30:53.297066 tds_put_string converting 10 bytes of "MyServer2k"
08:30:53.297075 tds_put_string wrote 20 bytes
08:30:53.297083 tds_put_string converting 11 bytes of "TDS-Library"
08:30:53.297091 tds_put_string wrote 22 bytes
08:30:53.297099 tds_put_string converting 10 bytes of "us_english"
08:30:53.297108 tds_put_string wrote 20 bytes
08:30:53.297116 tds_put_string wrote 0 bytes
08:30:53.297148 tds_process_login_tokens()
Received header @ 08:30:53.297884
0000 04 01 01 79 00 35 01 00-                        |...y.5..|


Received packet @ 08:30:53.297914
0000 e3 1b 00 01 06 6d 00 61-00 73 00 74 00 65 00 72 |ã....m.a 
.s.t.e.r|
0010 00 06 6d 00 61 00 73 00-74 00 65 00 72 00 ab 66 |..m.a.s. 
t.e.r.«f|
0020 00 45 16 00 00 02 00 25-00 43 00 68 00 61 00 6e |.E.....% 
.C.h.a.n|
0030 00 67 00 65 00 64 00 20-00 64 00 61 00 74 00 61 |.g.e.d.  
.d.a.t.a|
0040 00 62 00 61 00 73 00 65-00 20 00 63 00 6f 00 6e |.b.a.s.e . 
.c.o.n|
0050 00 74 00 65 00 78 00 74-00 20 00 74 00 6f 00 20 |.t.e.x.t . 
.t.o. |
0060 00 27 00 6d 00 61 00 73-00 74 00 65 00 72 00 27 |.'.m.a.s 
.t.e.r.'|
0070 00 2e 00 08 53 00 51 00-4c 00 2d 00 32 00 30 00 |....S.Q. L.-
.2.0.|
0080 30 00 30 00 00 00 00 e3-08 00 07 05 0b 04 d0 00 |0.0....ã 
......Ð.|
0090 3c 00 e3 17 00 02 0a 75-00 73 00 5f 00 65 00 6e |<.ã....u 
.s._.e.n|
00a0 00 67 00 6c 00 69 00 73-00 68 00 00 ab 6a 00 47 |.g.l.i.s 
.h..«j.G|
00b0 16 00 00 01 00 27 00 43-00 68 00 61 00 6e 00 67 |.....'.C 
.h.a.n.g|
00c0 00 65 00 64 00 20 00 6c-00 61 00 6e 00 67 00 75 |.e.d. .l 
.a.n.g.u|
00d0 00 61 00 67 00 65 00 20-00 73 00 65 00 74 00 74 |.a.g.e.  
.s.e.t.t|
00e0 00 69 00 6e 00 67 00 20-00 74 00 6f 00 20 00 75 |.i.n.g.  .t.o. 
.u|
00f0 00 73 00 5f 00 65 00 6e-00 67 00 6c 00 69 00 73 |.s._.e.n 
.g.l.i.s|
0100 00 68 00 2e 00 08 53 00-51 00 4c 00 2d 00 32 00 |.h....S. Q.L.-
.2.|
0110 30 00 30 00 30 00 00 00-00 ad 36 00 01 71 00 00 |0.0.0... 
.­6..q..|
0120 01 16 4d 00 69 00 63 00-72 00 6f 00 73 00 6f 00 |..M.i.c. 
r.o.s.o.|
0130 66 00 74 00 20 00 53 00-51 00 4c 00 20 00 53 00 |f.t. .S. Q.L. 
.S.|
0140 65 00 72 00 76 00 65 00-72 00 00 00 00 00 08 00 |e.r.v.e. 
r.......|
0150 02 f8 e3 13 00 04 04 34-00 30 00 39 00 36 00 04 |.øã....4 
.0.9.6..|
0160 34 00 30 00 39 00 36 00-fd 00 00 00 00 00 00 00 |4.0.9.6. 
ý.......|
0170 00                     -                        |.|


08:30:53.298074 looking for login token, got  e3(ENVCHANGE)
08:30:53.298084 tds_process_default_tokens() marker is e3(ENVCHANGE)
tds_get_string: reading 12 from wire to give 6 to client.
tds_get_string: reading 12 from wire to give 6 to client.
08:30:53.298122 looking for login token, got  ab(INFO)
08:30:53.298132 tds_process_default_tokens() marker is ab(INFO)
tds_get_string: reading 74 from wire to give 37 to client.
tds_get_string: reading 16 from wire to give 8 to client.
08:30:53.298161 looking for login token, got  e3(ENVCHANGE)
08:30:53.298171 tds_process_default_tokens() marker is e3(ENVCHANGE)
08:30:53.298259 tds_iconv_info_init: converting "ISO-8859-1"-
>"CP1252"
08:30:53.298272 looking for login token, got  e3(ENVCHANGE)
08:30:53.298281 tds_process_default_tokens() marker is e3(ENVCHANGE)
tds_get_string: reading 20 from wire to give 10 to client.
08:30:53.298298 looking for login token, got  ab(INFO)
08:30:53.298307 tds_process_default_tokens() marker is ab(INFO)
tds_get_string: reading 78 from wire to give 39 to client.
tds_get_string: reading 16 from wire to give 8 to client.
08:30:53.298421 looking for login token, got  ad(LOGINACK)
tds_get_string: reading 44 from wire to give 22 to client.
08:30:53.298456 looking for login token, got  e3(ENVCHANGE)
08:30:53.298465 tds_process_default_tokens() marker is e3(ENVCHANGE)
tds_get_string: reading 8 from wire to give 4 to client.
tds_get_string: reading 8 from wire to give 4 to client.
08:30:53.298488 increasing block size from 4096 to 4096
08:30:53.298504 looking for login token, got  fd(DONE)
08:30:53.298514 tds_process_default_tokens() marker is fd(DONE)
08:30:53.298523 tds_process_end: more_results = 0
                was_cancelled = 0
                error = 0
                done_count_valid = 0
08:30:53.298533 tds_process_end() state set to TDS_IDLE
08:30:53.298541 leaving tds_process_login_tokens() returning 1
08:30:53.298559 tds_put_string converting 19 bytes of "set textsize 
64512 "
08:30:53.298569 tds_put_string wrote 38 bytes
Sending packet @ 08:30:53.298578
0000 01 01 00 2e 00 00 01 00-73 00 65 00 74 00 20 00 |........ s.e.t. 
.|
0010 74 00 65 00 78 00 74 00-73 00 69 00 7a 00 65 00 |t.e.x.t. 
s.i.z.e.|
0020 20 00 36 00 34 00 35 00-31 00 32 00 20 00       | .6.4.5. 1.2. 
.|


Received header @ 08:30:53.298958
0000 04 01 00 11 00 35 01 00-                        |.....5..|


Received packet @ 08:30:53.298977
0000 fd 00 00 be 00 00 00 00-00                      |ý..¾.... .|


08:30:53.298991 processing result tokens.  marker is  fd(DONE)
08:30:53.299000 tds_process_end: more_results = 0
                was_cancelled = 0
                error = 0
                done_count_valid = 0
08:30:53.299010 tds_process_end() state set to TDS_IDLE
08:30:53.299019 tds_process_result_tokens() state is COMPLETED
08:31:16.506230 tds_put_string converting 56 bytes of "SELECT * FROM 
db_uutiskirjeet..Topics WHERE topic_id<10
"
08:31:16.506293 tds_put_string wrote 112 bytes
Sending packet @ 08:31:16.506304
0000 01 01 00 78 00 00 01 00-53 00 45 00 4c 00 45 00 |...x.... 
S.E.L.E.|
0010 43 00 54 00 20 00 2a 00-20 00 46 00 52 00 4f 00 |C.T. .*.  
.F.R.O.|
0020 4d 00 20 00 64 00 62 00-5f 00 75 00 75 00 74 00 |M. .d.b. 
_.u.u.t.|
0030 69 00 73 00 6b 00 69 00-72 00 6a 00 65 00 65 00 |i.s.k.i. 
r.j.e.e.|
0040 74 00 2e 00 2e 00 54 00-6f 00 70 00 69 00 63 00 |t.....T. 
o.p.i.c.|
0050 73 00 20 00 57 00 48 00-45 00 52 00 45 00 20 00 |s. .W.H. E.R.E. 
.|
0060 74 00 6f 00 70 00 69 00-63 00 5f 00 69 00 64 00 |t.o.p.i. 
c._.i.d.|
0070 3c 00 31 00 30 00 0a 00-                        |<.1.0...|


Received header @ 08:31:16.507334
0000 04 01 07 91 00 35 01 00-                        |.....5..|


Received packet @ 08:31:16.507377
0000 81 08 00 00 00 10 00 38-08 74 00 6f 00 70 00 69 |.......8 
.t.o.p.i|
0010 00 63 00 5f 00 69 00 64-00 00 00 09 00 af 50 00 |.c._.i.d 
.....¯P.|
0020 0b 04 d0 00 3c 0a 74 00-6f 00 70 00 69 00 63 00 |..Ð.<.t. 
o.p.i.c.|
0030 5f 00 6e 00 61 00 6d 00-65 00 00 00 09 00 26 04 |_.n.a.m. 
e.....&.|
0040 09 74 00 6f 00 70 00 69-00 63 00 5f 00 63 00 61 |.t.o.p.i 
.c._.c.a|
0050 00 74 00 00 00 09 00 26-04 0b 74 00 6f 00 70 00 |.t.....& 
..t.o.p.|
0060 69 00 63 00 5f 00 66 00-6c 00 61 00 67 00 73 00 |i.c._.f. 
l.a.g.s.|
0070 00 00 09 00 23 00 fc 00-00 0b 04 d0 00 3c 17 00 |....#.ü. 
...Ð.<..|
0080 64 00 62 00 5f 00 75 00-75 00 74 00 69 00 73 00 |d.b._.u. 
u.t.i.s.|
0090 6b 00 69 00 72 00 6a 00-65 00 65 00 74 00 2e 00 |k.i.r.j. 
e.e.t...|
00a0 2e 00 54 00 6f 00 70 00-69 00 63 00 73 00 0a 74 |..T.o.p. 
i.c.s..t|
00b0 00 6f 00 70 00 69 00 63-00 5f 00 68 00 74 00 6d |.o.p.i.c 
._.h.t.m|
00c0 00 6c 00 00 00 09 00 6f-08 0c 74 00 6f 00 70 00 |.l.....o 
..t.o.p.|
00d0 69 00 63 00 5f 00 6c 00-6f 00 63 00 6b 00 65 00 |i.c._.l. 
o.c.k.e.|
00e0 64 00 00 00 09 00 af fe-00 0b 04 d0 00 3c 09 74 |d.....¯þ 
...Ð.<.t|
00f0 00 6f 00 70 00 69 00 63-00 5f 00 75 00 72 00 6c |.o.p.i.c 
._.u.r.l|
0100 00 00 00 09 00 af fe 00-0b 04 d0 00 3c 09 74 00 |.....¯þ. 
..Ð.<.t.|
0110 6f 00 70 00 69 00 63 00-5f 00 69 00 6d 00 67 00 |o.p.i.c. 
_.i.m.g.|
0120 d1 08 00 00 00 50 00 50-84 84 73 74 94 6b 61 75 |Ñ....P.P 
..st.kau|
0130 70 70 61 6c 61 6b 69 20-68 79 76 84 6b 73 79 74 |ppalaki  
hyv.ksyt|
0140 74 79 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |ty              
 |
0150 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0160 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0170 20 20 20 20 20 20 20 04-06 00 00 00 04 01 00 00 |       . 
........|
0180 00 10 ff ff 34 01 00 00-00 00 22 05 00 00 01 00 |..ÿÿ4... 
..".....|
0190 05 00 64 75 6d 6d 79 54-53 00 0f 02 00 00 3c 50 |..dummyT 
S.....<P|
01a0 3e 50 84 84 73 74 94 6b-61 75 70 70 61 6c 61 6b |>P..st.k 
auppalak|
01b0 69 20 28 48 45 20 34 39-2f 32 30 30 34 29 20 68 |i (HE 49 /2004) 
h|
01c0 79 76 84 6b 73 79 74 74-69 69 6e 20 65 64 75 73 |yv.ksytt iin 
edus|
01d0 6b 75 6e 6e 61 73 73 61-20 33 30 2e 36 2e 32 30 |kunnassa  
30.6.20|
01e0 30 34 2e 20 4c 61 6b 69-20 74 75 6c 65 65 20 76 |04. Laki  tulee 
v|
01f0 6f 69 6d 61 61 6e 20 68-65 69 6e 84 6b 75 75 6e |oimaan h 
ein.kuun|
0200 20 32 30 30 34 20 61 69-6b 61 6e 61 2e 20 53 65 | 2004 ai kana. 
Se|
0210 20 6d 84 84 72 69 74 74-65 6c 65 65 26 6e 62 73 | m..ritt 
elee&nbs|
0220 70 3b 20 68 69 69 6c 69-64 69 6f 6b 73 69 64 69 |p; hiili 
dioksidi|
0230 70 84 84 73 74 94 6f 69-6b 65 75 6b 73 69 65 6e |p..st.oi 
keuksien|
0240 20 6a 61 6b 6f 6b 72 69-74 65 65 72 69 74 20 70 | jakokri teerit 
p|
0250 84 84 73 74 94 6b 61 75-70 61 6e 20 70 69 69 72 |..st.kau pan 
piir|
0260 69 69 6e 20 6b 75 75 6c-75 76 61 6c 6c 65 20 74 |iin kuul uvalle 
t|
0270 6f 69 6d 69 6a 61 6c 6c-65 20 76 75 6f 73 69 6c |oimijall e 
vuosil|
0280 6c 65 20 32 30 30 35 2d-32 30 30 37 2e 20 50 84 |le 2005- 2007. 
P.|
0290 84 73 74 94 6f 69 6b 65-75 6b 73 69 65 6e 20 6a |.st.oike uksien 
j|
02a0 61 6b 6f 6b 72 69 74 65-65 72 69 74 20 73 69 73 |akokrite erit 
sis|
02b0 84 6c 74 84 76 84 20 6e-73 2e 20 6b 61 6e 73 61 |.lt.v. n s. 
kansa|
02c0 6c 6c 69 6e 65 6e 20 6a-61 6b 6f 73 75 75 6e 6e |llinen j 
akosuunn|
02d0 69 74 65 6c 6d 61 20 70-69 74 84 84 20 76 69 65 |itelma p it.. 
vie|
02e0 6c 84 20 68 79 76 84 6b-73 79 74 74 84 84 20 6b |l. hyv.k sytt.. 
k|
02f0 6f 6d 69 73 73 69 6f 6c-6c 61 2e 20 53 79 79 73 |omissiol la. 
Syys|
0300 6b 75 75 6e 20 32 30 30-34 20 6c 6f 70 70 75 75 |kuun 200 4 
loppuu|
0310 6e 20 6d 65 6e 6e 65 73-73 84 20 6c 61 69 6e 20 |n mennes s. 
lain |
0320 70 69 69 72 69 69 6e 20-6b 75 75 6c 75 76 61 74 |piiriin  
kuuluvat|
0330 20 79 72 69 74 79 6b 73-65 74 20 68 61 6b 65 76 | yrityks et 
hakev|
0340 61 74 20 6d 61 6b 73 75-74 74 6f 6d 69 61 20 70 |at maksu ttomia 
p|
0350 84 84 73 74 94 6f 69 6b-65 75 6b 73 69 61 20 56 |..st.oik euksia 
V|
0360 61 6c 74 69 6f 6e 65 75-76 6f 73 74 6f 6c 74 61 |altioneu 
vostolta|
0370 20 6a 61 20 6b 61 73 76-69 68 75 6f 6e 65 6b 61 | ja kasv 
ihuoneka|
0380 61 73 75 6c 75 70 69 61-26 6e 62 73 70 3b 20 45 |asulupia &nbsp; 
E|
0390 6e 65 72 67 69 61 6d 61-72 6b 6b 69 6e 61 76 69 |nergiama 
rkkinavi|
03a0 72 61 73 74 6f 6c 74 61-2e 3c 2f 50 3e 08 56 95 |rastolta 
.</P>.V.|
03b0 00 00 f1 89 03 01 fe 00-68 74 74 70 3a 2f 2f 77 |..ñ...þ. 
http://w|
03c0 77 77 2e 6b 75 6e 6e 61-74 2e 6e 65 74 2f 6b 5f |ww.kunna 
t.net/k_|
03d0 70 65 72 75 73 73 69 76-75 2e 61 73 70 3f 70 61 |perussiv 
u.asp?pa|
03e0 74 68 3d 31 3b 32 39 3b-36 35 3b 33 35 36 3b 31 |th=1;29; 
65;356;1|
03f0 30 33 33 3b 33 37 39 30-32 3b 34 39 39 30 39 20 |033;3790 
2;49909 |
0400 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0410 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0420 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0430 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0440 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0450 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0460 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0470 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0480 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0490 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
04a0 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
04b0 20 20 20 20 20 20 ff ff-d1 09 00 00 00 50 00 4b |      ÿÿ 
Ñ....P.K|
04c0 75 6e 74 61 6d 61 72 6b-6b 69 6e 6f 69 6c 6c 61 |untamark 
kinoilla|
04d0 20 6f 6c 69 20 76 84 6b-65 84 20 20 20 20 20 20 | oli v.k e.     
 |
04e0 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
04f0 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0500 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 04 |                
.|
0510 07 00 00 00 04 01 00 00-00 10 ff ff 35 01 00 00 |........ 
..ÿÿ5...|
0520 00 00 22 05 00 00 01 00-07 00 64 75 6d 6d 79 54 |.."..... 
..dummyT|
0530 53 00 3f 01 00 00 3c 50-3e 31 30 2e 39 2e 32 30 |S.?...<P 
>10.9.20|
0540 30 34 20 4b 75 6e 74 61-74 61 6c 6f 73 73 61 20 |04 Kunta 
talossa |
0550 6a 84 72 6a 65 73 74 65-74 79 69 6c 6c 65 20 4b |j.rjeste tyille 
K|
0560 75 6e 74 61 6d 61 72 6b-6b 69 6e 6f 69 6c 6c 65 |untamark 
kinoille|
0570 20 6f 73 61 6c 6c 69 73-74 75 69 20 36 20 34 30 | osallis tui 6 
40|
0580 30 20 6b 84 76 69 6a 84-84 20 65 72 69 20 70 75 |0 k.vij. . eri 
pu|
0590 6f 6c 69 6c 74 61 20 6d-61 61 74 61 2e 20 54 6f |olilta m aata. 
To|
05a0 72 73 74 61 69 6e 20 6a-61 20 70 65 72 6a 61 6e |rstain j a 
perjan|
05b0 74 61 69 6e 20 61 69 6b-61 6e 61 20 6a 84 72 6a |tain aik ana 
j.rj|
05c0 65 73 74 65 74 74 69 69-6e 20 31 38 36 20 73 65 |estettii n 186 
se|
05d0 6d 69 6e 61 61 72 69 61-20 6a 61 20 74 69 65 74 |minaaria  ja 
tiet|
05e0 6f 69 73 6b 75 61 2e 20-4e 84 79 74 74 65 69 6c |oiskua.  
N.ytteil|
05f0 6c 65 61 73 65 74 74 61-6a 69 61 20 6f 6c 69 20 |leasetta jia 
oli |
0600 31 33 34 2e 20 4b 75 6e-74 61 6d 61 72 6b 6b 69 |134. Kun 
tamarkki|
0610 6e 61 74 20 4b 75 6e 74-61 74 61 6c 6f 6c 6c 61 |nat Kunt 
atalolla|
0620 20 6a 84 72 6a 65 73 74-65 74 74 69 69 6e 20 6e | j.rjest ettiin 
n|
0630 79 74 20 31 31 2e 20 6b-65 72 72 61 6e 2e 20 45 |yt 11. k erran. 
E|
0640 6e 73 69 20 76 75 6f 6e-6e 61 20 4b 75 6e 74 61 |nsi vuon na 
Kunta|
0650 6d 61 72 6b 6b 69 6e 61-74 20 70 69 64 65 74 84 |markkina t 
pidet.|
0660 84 6e 20 31 35 2e 2d 31-36 2e 39 2e 32 30 30 35 |.n 15.-1 
6.9.2005|
0670 2e 3c 2f 50 3e 08 62 95-00 00 14 96 c9 00 fe 00 |.</P>.b. 
....É.þ.|
0680 68 74 74 70 3a 2f 2f 77-77 77 2e 6b 75 6e 6e 61 |http://w 
ww.kunna|
0690 74 2e 6e 65 74 2f 6b 5f-70 65 72 75 73 6c 69 73 |t.net/k_ 
peruslis|
06a0 74 61 73 69 76 75 2e 61-73 70 3f 70 61 74 68 3d |tasivu.a 
sp?path=|
06b0 31 3b 32 39 3b 36 35 3b-33 35 36 3b 33 32 38 35 |1;29;65; 
356;3285|
06c0 35 3b 36 38 31 37 30 20-20 20 20 20 20 20 20 20 |5;68170         
 |
06d0 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
06e0 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
06f0 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0700 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0710 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0720 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0730 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0740 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0750 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0760 20 20 20 20 20 20 20 20-20 20 20 20 20 20 20 20 |                
 |
0770 20 20 20 20 20 20 20 20-20 20 20 20 20 20 ff ff |               
ÿÿ|
0780 fd 10 00 c1 00 02 00 00-00                      |ý..Á.... .|


08:31:16.508203 processing result tokens.  marker is  81(TDS7_RESULT)
tds_get_string: reading 16 from wire to give 8 to client.
08:31:16.508272 tds7_get_data_info:1451:
        colname = topic_id (8 bytes)
        type = 56 (int)
        server's type = 56 (int)
        column_varint_size = 0
        column_size = 4 (4 on server)
08:31:16.508294 adjust_character_column_size:
        Server charset: CP1252
        Server column_size: 80
        Client charset: ISO-8859-1
        Client column_size: 80
tds_get_string: reading 20 from wire to give 10 to client.
08:31:16.508314 tds7_get_data_info:1451:
        colname = topic_name (10 bytes)
        type = 47 (char)
        server's type = 175 (xchar)
        column_varint_size = 2
        column_size = 80 (80 on server)
tds_get_string: reading 18 from wire to give 9 to client.
08:31:16.508335 tds7_get_data_info:1451:
        colname = topic_cat (9 bytes)
        type = 38 (integer-null)
        server's type = 38 (integer-null)
        column_varint_size = 1
        column_size = 4 (4 on server)
tds_get_string: reading 22 from wire to give 11 to client.
08:31:16.508380 tds7_get_data_info:1451:
        colname = topic_flags (11 bytes)
        type = 38 (integer-null)
        server's type = 38 (integer-null)
        column_varint_size = 1
        column_size = 4 (4 on server)
08:31:16.508395 adjust_character_column_size:
        Server charset: CP1252
        Server column_size: 64512
        Client charset: ISO-8859-1
        Client column_size: 64512
tds_get_string: reading 46 from wire to give 23 to client.
tds_get_string: reading 20 from wire to give 10 to client.
08:31:16.508420 tds7_get_data_info:1451:
        colname = topic_html (10 bytes)
        type = 35 (text)
        server's type = 35 (text)
        column_varint_size = 4
        column_size = 64512 (64512 on server)
tds_get_string: reading 24 from wire to give 12 to client.
08:31:16.508441 tds7_get_data_info:1451:
        colname = topic_locked (12 bytes)
        type = 111 (datetime-null)
        server's type = 111 (datetime-null)
        column_varint_size = 1
        column_size = 8 (8 on server)
08:31:16.508456 adjust_character_column_size:
        Server charset: CP1252
        Server column_size: 254
        Client charset: ISO-8859-1
        Client column_size: 254
tds_get_string: reading 18 from wire to give 9 to client.
08:31:16.508474 tds7_get_data_info:1451:
        colname = topic_url (9 bytes)
        type = 47 (char)
        server's type = 175 (xchar)
        column_varint_size = 2
        column_size = 254 (254 on server)
08:31:16.508488 adjust_character_column_size:
        Server charset: CP1252
        Server column_size: 254
        Client charset: ISO-8859-1
        Client column_size: 254
tds_get_string: reading 18 from wire to give 9 to client.
08:31:16.508506 tds7_get_data_info:1451:
        colname = topic_img (9 bytes)
        type = 47 (char)
        server's type = 175 (xchar)
        column_varint_size = 2
        column_size = 254 (254 on server)
08:31:16.508543 processing result tokens.  marker is  d1(ROW)
08:31:16.508555 processing row tokens.  marker is  d1(ROW)
08:31:16.508565 processing row.  column is 0 varint size = 0
08:31:16.508574 processing row.  column size is 4
08:31:16.508585 clearing column 0 NULL bit
08:31:16.508593 processing row.  column is 1 varint size = 2
08:31:16.508602 processing row.  column size is 80
08:31:16.508610 clearing column 1 NULL bit
08:31:16.508671 tds_client_msg: #2403: "WARNING! Some character(s) 
could not be converted into client's character set. Unconverted bytes 
were changed to question marks ('?').".  Connection state is now 1.
08:31:16.508686 processing row.  column is 2 varint size = 1
08:31:16.508696 processing row.  column size is 4
08:31:16.508704 clearing column 2 NULL bit
08:31:16.508711 processing row.  column is 3 varint size = 1
08:31:16.508720 processing row.  column size is 4
08:31:16.508727 clearing column 3 NULL bit
08:31:16.508735 processing row.  column is 4 varint size = 4
08:31:16.508743 processing row.  column size is 527
08:31:16.508751 clearing column 4 NULL bit
08:31:16.508789 tds_client_msg: #2403: "WARNING! Some character(s) 
could not be converted into client's character set. Unconverted bytes 
were changed to question marks ('?').".  Connection state is now 1.
08:31:16.508821 processing row.  column is 5 varint size = 1
08:31:16.508831 processing row.  column size is 8
08:31:16.508839 clearing column 5 NULL bit
08:31:16.508846 processing row.  column is 6 varint size = 2
08:31:16.508855 processing row.  column size is 254
08:31:16.508863 clearing column 6 NULL bit
08:31:16.508873 processing row.  column is 7 varint size = 2
08:31:16.508882 processing row.  column size is 0
08:31:16.508891 setting column 7 NULL bit
08:31:16.508952 processing row tokens.  marker is  d1(ROW)
08:31:16.508962 processing row.  column is 0 varint size = 0
08:31:16.508970 processing row.  column size is 4
08:31:16.508978 clearing column 0 NULL bit
08:31:16.508986 processing row.  column is 1 varint size = 2
08:31:16.508994 processing row.  column size is 80
08:31:16.509002 clearing column 1 NULL bit
08:31:16.509024 tds_client_msg: #2403: "WARNING! Some character(s) 
could not be converted into client's character set. Unconverted bytes 
were changed to question marks ('?').".  Connection state is now 1.
08:31:16.509054 processing row.  column is 2 varint size = 1
08:31:16.509064 processing row.  column size is 4
08:31:16.509072 clearing column 2 NULL bit
08:31:16.509080 processing row.  column is 3 varint size = 1
08:31:16.509088 processing row.  column size is 4
08:31:16.509096 clearing column 3 NULL bit
08:31:16.509103 processing row.  column is 4 varint size = 4
08:31:16.509112 processing row.  column size is 319
08:31:16.509119 clearing column 4 NULL bit
08:31:16.509148 tds_client_msg: #2403: "WARNING! Some character(s) 
could not be converted into client's character set. Unconverted bytes 
were changed to question marks ('?').".  Connection state is now 1.
08:31:16.509165 processing row.  column is 5 varint size = 1
08:31:16.509175 processing row.  column size is 8
08:31:16.509183 clearing column 5 NULL bit
08:31:16.509190 processing row.  column is 6 varint size = 2
08:31:16.509199 processing row.  column size is 254
08:31:16.509206 clearing column 6 NULL bit
08:31:16.509217 processing row.  column is 7 varint size = 2
08:31:16.509226 processing row.  column size is 0
08:31:16.509233 setting column 7 NULL bit
08:31:16.509263 processing row tokens.  marker is  fd(DONE)
08:31:16.509272 tds_process_end: more_results = 0
                was_cancelled = 0
                error = 0
                done_count_valid = 1
08:31:16.509283 tds_process_end() state set to TDS_IDLE
08:31:16.509290                  rows_affected = 2
08:31:16.509298 tds_process_result_tokens() state is COMPLETED
apps:/etc/freetds #


> What is the column's datatype?  Unicode datatypes (nchar, nvarchar)
> have seen more testing than single-byte charsets.  Are both broken for
> you?  

The problem manifests itself both on char and text-datatypes.
> 
> http://www.microsoft.com/globaldev/nlsweb/default.asp?submitted=40b
> http://www.microsoft.com/globaldev/reference/oem/850.htm
> http://www.microsoft.com/globaldev/reference/sbcs/1252.htm
> 
> 1> sp_helpsort
> 2> select char(0xE4), char(0x84)
> 3> go

1> sp_helpsort
2> select char(0xE4),char(0x84)
3> go

Got the following answers - which more or less confirm with your 
assumptions ;)

------ clip --- clip -- clipetyclip ------

Server default collation
Finnish-Swedish, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive for Unicode Data, SQL Server Sort Order 60 on Code Page 850 for non-Unicode Data
(return status = 0)

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 ('?').
ä       ?

------ clip --- clip -- clipetyclip ------

If I set the client charcter set cp1252, the characters get encoded, 
but wrongly. Of course I could translate these characters to the 
right ones, but it looks unproductive ;)
 
> By the way, as long as it's broken ;-) you shouldn't be able to insert
> 'a umlaut', either.  The INSERT statement should fail (not convert
> your data to '?').  

Well, as a matter of fact, I don't need (at least so far) any 
INSERTS, the database is put up on another server.

Best regards

Hannu



More information about the FreeTDS mailing list