Skip to Content.
Sympa Menu

freetds - Re: [freetds] Status of UTF-8 support in 0.83 dev

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Sebastien FLAESCH <sf AT 4js.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Status of UTF-8 support in 0.83 dev
  • Date: Thu, 14 Aug 2008 16:24:47 +0200

About ParameterType in SQLBindParameter:

From my understanding, if on Windows you write a "UNICODE" UCS-2 ODBC
application using wchar_t/WCHAR, you have to bind using:

SQL_C_WCHAR + SQL_W[VAR]CHAR

But what about UTF-8 ODBC applications in FreeTDS?

Does FreeTDS ODBC consider that UTF-8 is an equivalent for the Microsoft
"UNICODE" and therefore must be bound with SQL_C_CHAR + SQL_W[VAR]CHAR?

IBM DB2 CLI says UTF-8 data can be bound with SQL_[VAR]CHAR:


http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db29.doc.odbc/db2z_utf8pm.htm

Microsoft says SQL_W[VAR]CHAR has to be used for "Unicode character string"
(I guess they talk about UCS-2):

http://msdn.microsoft.com/en-us/library/ms710150(VS.85).aspx

What's the right way?

Seb

Sebastien FLAESCH wrote:
James,

When I print the client and the server charset in tds_convert_string()
called from tds_put_data(), I see:

char_conv->client_charset.name = "UTF-8"
char_conv->server_charset.name = "CP1252"

I expected UCS-2 for the server charset...????

Hence it's normal that the conversion of non-CP1252 compatible chars
like 鴻 result in error...

I appears that curcol->char_conv points to the client2server_chardata
TDSICONV structure, because in tds_set_param_type(), the data type is
not identified as a UNICODE type...

So when binding the buffers with sqltype SQL_[VAR]CHAR, it appears that
the Sybase type used is not "UNICODE"...

Should I then bind with SQL_WCHAR / SQL_WVARCHAR?

I made a little test (attached, with log)... still failing.

Seb


------------------------------------------------------------------------

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





Archive powered by MHonArc 2.6.24.

Top of Page