Re: Status of UTF-8 support in 0.83 dev

Sebastien FLAESCH <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Organization Four J's Development Tools
Message-ID <[email protected]>
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
> [email protected]
> http://lists.ibiblio.org/mailman/listinfo/freetds

_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.