Subject | [Firebird-Java] Re: Character Sets & Accessing Firebird using Jaybird |
---|---|
Author | Burghard Britzke |
Post date | 2004-06-04T16:53:50Z |
well, if there is a ResultSet.getBytes() then try to convert it with
"new String(ResultSet.getBytes,"ISO8859-1")"
--
http://www.panarchy.org/bastiat/petition.eng.1845.html
Am 04.06.2004 um 15:58 schrieb Roman Rokytskyy:
"new String(ResultSet.getBytes,"ISO8859-1")"
--
http://www.panarchy.org/bastiat/petition.eng.1845.html
Am 04.06.2004 um 15:58 schrieb Roman Rokytskyy:
> Hi,[Non-text portions of this message have been removed]
>
> > We have a rather large Firebird database that was created a long
> time
> > ago (as an Interbase DB) using character set "NONE". We use it from
> > Java 1.4.2. by means of Interclient. The data in there is actually
> ISO
> > 8859-1 (but the DB does not know about it).
> >
> > We want to replace Interclient by Jaybird, but did run into a
> problem
> > with the character sets. When connecting using character set "NONE",
> > we can read and write, but any non-ASCII character seems to be
> ignored
> > (replaced by "?"). When we indicate ISO8859_1, it tries to convert,
> > which of course fails.
> >
> > What can we do to achieve 8-bit transparent access to the DB using
> > Jaybird? Or is there a different approach that we could try?
>
> This is a bit non-trivial from the first sight. There's few things to
> keep in mind, and then it will be clear how to solve the issue:
>
> - "NONE" for JayBird means: "convert byte array you get from server to
> String using new String(byte[]) constructor".
>
> - when no encoding is passed to String constructor, it will take the
> system default one.
>
> Following happens: JayBird receives data from server and converts them
> into string using new String(byte[]) constructor. JVM tries to convert
> data into Unicode representation and for some characters it fails and
> replaces them with '?'. Why? Because default encoding for the JVM does
> not have that characters. How to solve? Either set correct system-wide
> character set (I suspect your JVM runs on Linux and LANG or LC_CTYPE
> is "C", set it to "ISO-Latin-1") or pass it with
> -Dfile.encoding=Cp1252 for example.
>
> To verify what I'm saying you can do following: use
> ResultSet.getBytes() method instead of getString() and save those byte
> arrays into some file. Then open it with a java.io.Reader and check
> the string you get.
>
> Also, one of the possible issues can be that JVM works correctly, but
> your terminal simply does not show such characters.
>
> Roman
>
>
>
>
> Yahoo! Groups Sponsor
>
> ADVERTISEMENT
> <yhoo0504_testb_300250a052604.gif>
> <l.gif>
>
> Yahoo! Groups Links
>
> � To visit your group on the web, go to:
> http://groups.yahoo.com/group/Firebird-Java/
> �
> � To unsubscribe from this group, send an email to:
> Firebird-Java-unsubscribe@yahoogroups.com
> �
> � Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
>
>