Subject Re: [Firebird-Java] Re: PS about client-to-FBcore protocols regarding charset, #5.
Author Mark Rotteveel
On 29-6-2012 15:06, Roman Rokytskyy wrote:
>>> UTF-8 works fine for all latin-based charsets, it is bad for Cyrillic -
>>> 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.
> Are you talking about the size of C++ buffer in XSQLVAR or you talk
> 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.

As far as I remember the sqldata and the network packet where identical
in content (which is the full declared length). But I have a ticket to
investigate and fix if needed (JDBC-237).

Mark Rotteveel