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: "James K. Lowden" <jklowden AT freetds.org>
  • 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 10:46:01 -0400

Sebastien FLAESCH wrote:
> 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

I agree with IBM.

"Wide" characters have a fixed width, usually 16 bits. UTF-8 has a
variable width and for the most part can be treated like ASCII (strlen(3)
et al.). Declaring UTF-8 as SQL_C_WCHAR incorrectly tells the driver
there's a character in every two bytes.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page