gnu.gcj.convert.UnicodeToBytes and gnu.gcj.convert.Output_UnicodeLittle
Andreas Grunewald
gruni.ca@gmail.com
Wed Apr 20 20:14:00 GMT 2005
Hello Sven thanks for the Clarification
2005年4月20日, Sven de Marothy <sven@physto.se>:
> Hello Andreas,
> First off, I need to adress some of your previous statements.
>> "in my understanding if Charset.available has UTF-16LE in it the String
> constructor should work"
>> This is a misinterpretation. Charset.available() returns the available
> java.NIO charsets, which are NOT necessarily the same as those available for
> java.io and java.lang. See:
> http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html
Well I got this understanding from the API docs of Java who refere in
the String class to
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#String(byte[],%20java.lang.String)
But thank you for pointing me to that.
>> This still works for UTF-16LE because it is available in both, but
> the problem here was static linking, as stated earlier. The proper thing to use
> with the String constructor is "UnicodeLittleUnmarked" and not "UTF-16LE" though.
So you are saying that should work I'm gonna try this.
> Because it's supported by the GCJ NIO encoders.
> If you want to use them to convert bytes to chars and create a string
> from them you can do it like this:
>> ....
>> But if all you want is UTF16LE, you could easily just skip all this
> encoding framework stuff and just exploit the fact that UTF16 is native
> to java, e.g. bytes-to-char: (little endian)
> ...
>Thing is I am using an external Library, I'll try the modifications
and maybe suggest the wrter to change the release version of it. So
I'll try all of it, and see what I can doe with changing the origina
code of the lib the least.
> We're currently in the process of moving the String and java.io stuff
> over to using the NIO encoders/decoders internally. (In which case
> Charset.available() _will_ match those supported by String) but again,
> this is not behaviour you should rely on. When this transition is
> completed, both java and native converters will be available, too.
Ok I really have to thank you for all this clarifying I really helps a
lot, but why isn't that just somewhere in the GCJ documentaion of FAQ
or something. If it is somewhere I wasn't able to find it. So one last
question is there a way to qeuery the available java.lang charsets ?
Regards and thanks
Andreas
More information about the Java
mailing list