wrote:
> A related question, has anyone else tried to pass UTF-8 (or other
> Unicode) to java program via proram arguments. Before entering
> main(String args[]) JVM likely uses system's default character encoding
> to make each member of args.
According to the source to the launcher, it interprets the argument strings as
byte arrays encoded using the value of the system property "sun.jnu.encoding".
I don't think that's /exactly/ the same as system default encoding
(Charset.defaultCharset() returns the value of the "file.encoding" property),
though I imagine they will usually coincide in practice. That property seems
to be used for general JNI-related things (including AWT), so, althought I
suppose you /could/ use:
java -Dsun.jnu.encoding=UTF-8 ...
somehow I don't think it would be a very good idea
> So I encoded each UTF-8 character in something I
> knew would be passed correctly and subsequently decoded on Java side.
Sounds like the right way to do it. Especially as not all systems make it easy
to enter UTF-8 on the command line.
-- chris