Skip to Content.
Sympa Menu

freetds - [freetds] Char set conversion routines

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "David Nsengiyumva" <davidn AT finsolutions.co.za>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Char set conversion routines
  • Date: Wed, 10 Dec 2003 08:26:33 +0200

Hi there,

I got the latest source codes for FreeTDS 8 from
CVS( http://wwww.sf.net )and It seems that there are
character conversion routines that I don't understand. I just want to know
that if I am trying to access MS SQL Server 2000 what caracter set must I
set to the 'connect_info->client_charset'.

I've tryied several settings but It does not work. Is there any
documentation about it???

First of all, I've set the 'HAVE_ICONV_ALWAYS' marco to 1 and hence the data
conversion routines will be used. As far as I can understand the 'iconv'
functions.... We've got an array 'canonic_charsets' that consists of
'TDS_ENCODING' and the 'TDS_ENCODING' is just a container (struct) of a
name, min_bytes_per_char and max_bytes_per_char. The first four elements of
the 'canonic_charsets' are set in the beginning ("ISO-8859-1", "UTF-8",
"UCS-2LE", "UCS-2BE").

The 'tds_iconv_init(void)' first calls 'iconv_open' with "ISO-8859-1" and
"UTF-8" as parameters. It seems that the 'iconv_open' function tries to find
if the conversion from 'fromcode' to 'tocode' is possible. But what I don't
understand is that, after testing the conversion from "UTF-8" to
"ISO-8859-1" (which in fact is possible), the 'tds_iconv_init' goes and
tries to find 'UCS-2' in the 'iconv_names'. In my case it does the long
search through the 'canonic_charsets' and it does obviously find the
"UCS-2". But then the search (still using the 'iconv_open' function) of
'iconv_aliases' and 'iconv_names'(this contains only "ISO-8859-1" and
"UTF-8") fails!!! But it sould actually find it because "ISO-8859-1" is
member of 'iconv_aliases' and so is "UTF-8"!!!

I also don't understand this code in the 'tds_iconv_init' function:

/* we need a UCS-2 (big endian or little endian) */
if (!iconv_names[POS_UCS2LE] && !iconv_names[POS_UCS2BE])
return 1;

for me the 'if' succeed and so the function returns 1. AND HENCE THE CALLING
('tds_iconv_open') FUNCTION DOES ASSERT. My interpretation to this is that I
have the wrong connect_info->charset. Can somebody be kind and give me a
documentation about this 'data charset conversion routines' or help me to
find a solution to this problem???? What do I need to do to be able to send
ASCII chars to the server (MS SQL Server 2000)???

My log file looks like this:

Starting log file for FreeTDS 0.60
on 2003-12-09 19:43:03 with debug level 99.
Using trivial iconv from
S:\Engines\source\freetds\src\replacements\iconv_replacement.c




Thanx a lot

David Nsengiyumva

Software Developer
Tel: +27 21 464 7215
Cel: +27 73 351 3975
Fax: +27 21 464 7201
http://www.finsolutions.co.za

CONFIDENTIALITY CAUTION
This page and any accompanying documents contain privileged and confidential
information for the specific individual to whom it is addressed, and are
protected by law. If the reader is not the intended recipient, you are
hereby notified that any review, dissemination, distribution or copying or
the taking of any action based on the contents of this communication is
strictly prohibited. If you have received this communication in error,
please desist from reading the contents, notify us immediately and destroy
the communication.






  • [freetds] Char set conversion routines, David Nsengiyumva, 12/10/2003

Archive powered by MHonArc 2.6.24.

Top of Page