Subject Re: [firebird-support] Re: Writing UTF16 to the database
Author Brad Pepers
fxam wrote:
>
>>I'm writing in C and have started using wchar_t strings internally, and
>>wish to write the contents of these to a firebird db. However, having
>>set the character set for the VARCHAR field to Unicode_fss, only the
>>first character of the field is written to the field (as I guess it
>>finds that the second byte in the string is zero). Is there a function I
>>can use to write a wchar_t string (UTF-16) to this field?
>
> You can use VARCHAR OCTETS to store UTF-16, OCTETS accepts everything
> including nulls, but you have to try yourself whether you can retrieve back
> all the null characters in the field.

But doing this or even storing UTF-8 into a varchar ends the ability of
the database to sort the data for you in the right order. If you use
octets I believe your data will be sorted using memcmp which is not
using any idea of a character encoding and will be wrong for many encodings.

--
Brad Pepers
brad@...