Subject | Re: lc_ctype support |
---|---|
Author | rrokytskyy |
Post date | 2002-04-09T23:17:21Z |
My previous reply to this post went to /dev/null on Yahoo! Groups, so
this would be just a short version of previous one (yes, I do use web
interface to post messages :)
"national_unicode" involves JVM default encoding (new String(byte[])
and String.getBytes() methods). That was used before, now the "dark
ages" are over.
converted to '?' by JVM in the str.getBytes() method. I repeat again,
my default JVM encoding is Cp1252.
The code you provided might work, but only if default JVM encodings
during data storing and retrieving are the same (and are the same to
encoding of the data source).
Best regards,
Roman Rokytskyy
this would be just a short version of previous one (yes, I do use web
interface to post messages :)
> r> If we agree, the client-side encoding is always UNICODE_FSSCheck the TestFBEncodings. :)
> r> (which is not too bad I think), then we really do not need all
> r> this conversion. Firebird will do (or is supposed to do) this
> r> automatically. But we then have to require people to set at
> r> least the default database encoding. We just pass the result of
> r> str.getBytes("UTF8") (not str.getBytes() because this will not
> r> be a unicode stream) to engine.
> r> And this is the responsibility of the engine to store data
> r> according to database/column definition.
>
> I'll be very happy if that works!!!!
> r> The main idea in the discussion is whether to provide or not anRight, and byte[] contains data in encoding specified by lc_ctype.
> r> option not to convert using this way: national_unicode-
> >>correct_unicode->connection_encoding->byte[], but
> >>national_unicode-
> >>byte[] directly if we assume that national_unicode and
> r> connection_encoding are the same.
>
> Actually now the driver does the following:
> when you read from the database:
> byte[] -> correct_unicode
> when you write to the database:Wrong. Only correct_unicode -> byte[] using the lc_ctype encoding.
> correct_unicode -> national_unicode -> byte[]
"national_unicode" involves JVM default encoding (new String(byte[])
and String.getBytes() methods). That was used before, now the "dark
ages" are over.
> I can ask again what to do with columns with different characterSet the lc_ctype to UNICODE_FSS.
> sets.
> Everything can be implemented ;) Moreover only one boolean fieldbe
> should be added to FBManagedConnection, and when is set NONE should
> returned by getIscEncoding:(GDS.isc_dpb_lc_ctype);
>
> public String getIscEncoding() {
> *****
> if (pleaseDontConvertMyAlreadyConvertedString)
> return "NONE";
> *****
>
>
> try {
> String result = cri.getStringProperty
> if (result == null) result = "NONE";Not really. I tried to use the same approach, but 0xF5 char was
> return result;
> } catch(NullPointerException ex) {
> return "NONE";
> }
> }
>
> That's all. The option can be passed with the Properties in the
> connect() in FBDriver.
converted to '?' by JVM in the str.getBytes() method. I repeat again,
my default JVM encoding is Cp1252.
The code you provided might work, but only if default JVM encodings
during data storing and retrieving are the same (and are the same to
encoding of the data source).
Best regards,
Roman Rokytskyy