Subject | Re: Writing UTF16 to the database |
---|---|
Author | fxam |
Post date | 2005-02-16T06:52:43Z |
> I'm writing in C and have started using wchar_t strings internally, andYou can use VARCHAR OCTETS to store UTF-16, OCTETS accepts everything
> 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?
including nulls, but you have to try yourself whether you can retrieve back
all the null characters in the field.
I use Delphi to write UTF-16 into VARCHAR OCTETS successfully using
Interbase dbExpress driver, the problem left is how to get the data back
in full shape including nulls. I will investigate again what Helen said
about default charset and _unicode_fss.
> Alternatively, is there a way of encoding a wchar_t to a single byteI tried Delphi to store and load UTF-8 successfully using Interbase
> encoding (must be able to store international data - maybe utf-8?) so
> that IT could go into firebird instead?
dbExpress driver. Since UTF-8 do not have null characters (except for the
null character itself), I guess you can use VARCHAR with any charset (I
used OCTETS). If your application does not support UTF-8 directly, you have
to convert the data from/to UTF-8 before making changes and after retrieving
data.