Subject | Re: [Firebird-Java] Re: PS about client-to-FBcore protocols regarding charset, #5. |
---|---|
Author | Roman Rokytskyy |
Post date | 2012-06-29T13:06:43Z |
>> UTF-8 works fine for all latin-based charsets, it is bad for Cyrillic -Are you talking about the size of C++ buffer in XSQLVAR or you talk
>> those would take 2 bytes instead of 1 byte. Others will take 2-3 bytes
>> anyway.
>
> For the JNI implementation that is definitely not what is happening: it
> is always sending 4x the declared field length in bytes. I haven't
> looked closely at the Java implementation yet, but I believe something
> similar happens.
about the network packet?
The XSQLVAR.sqldata must be 4*sqllen, since in worst-case it will need
those bytes. But in reallity it should use as many bytes as needed for
UTF-8 encoded string (2 bytes page selector + 1 byte per character for
west european charsets), and with garbage or zeros till the end of the
buffer. The network packet should contain only as many bytes as needed.
Roman