[freetds] select bug...

Spyros Ioakim sioakim at atlas.ace-hellas.gr
Mon May 12 17:38:57 EDT 2003


OK more trouble coming your way :-)

I have added client charset = ISO-8859-7 in freetds.conf and executed
tsql:
/usr/local/freetds/bin/tsql -Saceoffice -Usa -I
/usr/local/freetds/etc/freetds.conf 
locale is "en_US"
charset is "ISO-8859-1"
Password: 
Msg 5703, Level 0, State 1, Server ACEOFFICE, Line 0
Changed language setting to us_english.
1> 

No changing to ISO-8859-7.

Then changed my locale to el_GR:

/usr/local/freetds/bin/tsql -Saceoffice -Usa
locale is "el_GR"
charset is "ISO-8859-7"
Password: 

And tsql hangs there..
The log is full of the following:
Starting log file for FreeTDS 0.62.dev.20030511
        on 2003-05-13 00:16:07 with debug level 99.
iconv to convert client-side data to the "ISO-8859-7" character set
00:16:07.741573 tds_iconv_info_init: cannot convert
"ISO-8859-7"->"UCS-2LE"
00:16:07.741606 Connecting to 192.168.2.253 port 1433, TDS 8.0.
00:16:07.741954 tds_put_string converting 19 bytes of
"atlas.ace-hellas.gr"
00:16:07.741975 tds_put_string converting 19 bytes of
"atlas.ace-hellas.gr"
00:16:07.741990 tds_put_string converting 19 bytes of
"atlas.ace-hellas.gr"
00:16:07.742004 tds_put_string converting 19 bytes of
"atlas.ace-hellas.gr"
.
.
.


atlas.ace-hellas.gr is the box I'm trying to connect from.

In other words I can't switch to iso8859-7 and give it a shot.
Although I tried the following that makes sense with tsql in regard with
what you are saying:

/usr/local/freetds/bin/tsql -Saceoffice -Usa
/usr/local/freetds/etc/freetds.conf 
locale is "en_US"
charset is "ISO-8859-1"
Password: 
Msg 5703, Level 0, State 1, Server ACEOFFICE, Line 0
Changed language setting to us_english.
1> use office
2> select 'p' <--- This is greek letter Pi
3> go

?
1> 

So it has to do something with the greek characters and the charsets.

But the problem for me is that I can't switch to iso8859-7 to try it
out.

Thanks for all your help guys
Spyros

-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Lowden, James K
Sent: Monday, May 12, 2003 11:56 PM
To: 'FreeTDS Development Group'
Subject: RE: [freetds] select bug...


> From: Spyros Ioakim [mailto:sioakim at atlas.ace-hellas.gr]
> Sent: May 12, 2003 1:37 PM
> 
> First of all I see you have realised what the problem is.
> It is exactly as you describe.

Good. :-)

> I looked at my log file and indeed wherever there is a greek character

> it is represented by a greek character. That is the greek letter "Pi" 
> is not converted to english "P".

We have to very extremely specific here, lest we invite utter chaos.
What is this Pi you speak of?  

What you passed to the server was =00F0.  That's a number encoding a
character.  I think you meant that number to represent Pi, but it
doesn't.  

In ISO-8859-7, http://czyborra.com/charsets/iso8859-7.txt.gz, the 8-bit
value =F0 encodes the Greek small letter Pi.  UCS-2, used by your
faithful server, encodes that character with the 16-bit value U+03C0.
What you sent to the server, though, was the 16-bit value U+00F0, which
happens to be the UCS-2 encoding of the Latin small letter "Eth"
(http://www.unicode.org/Public/UNIDATA/NamesList.txt).  

The reason FreeTDS is doing this (sending 00F0 instead of 03C0) is that
it thinks your 8-bit client data are encoded by ISO-8859-1.  What you
see as Pi, it sees your =0F.  Because it thinks you're using ISO-8859-1,
it understands your =F0 to be Eth, recodes it for UCS-2, and sends it
along its merry way.  Lo, on the server you find Eth, not Pi.  QED.  

Here's a little experiment to test my theory:

1. create table T (T nchar(1))
2. /* on server */ insert T values ('p') -- Greek small letter Pi 3. /*
on client */ insert T values ('p') -- Greek small letter Pi 4. select
cast(T as varbinary(8)) as Hex from T

Result:

Hex
---------
03C0
00F0

If you "select * from T" on either the client or the server, you'll see
one "right" row and one wrong one.  On the server, the second row will
be Eth. On the client, the non-Pi row cannot be decoded, because FreeTDS
will fail to find a Pi character amongst the ISO-8859-1 characters it's
looking in.  

+++

> My locale is all english:
> LANG=en_US
[...]

What I don't understand is how your client can be set up that way and
still display Greek characters.  I *guess* you can install Greek fonts
and everything sort-of Just Works?  

To fix this in general, you need a Greek locale setup.  To fix the
particular problem, I think you need just one line in freetds.conf:

	client charset = ISO-8859-7

Well, that's enough postulation for me for one day.  Let us know how it
goes, Spyro.  

--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.


_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds




More information about the FreeTDS mailing list