Re: Status of UTF-8 support in 0.83 dev

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
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
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.