http://qs321.pair.com?node_id=851806


in reply to Re^3: passing data structures from java to perl
in thread passing data structures from java to perl

Java strings are UTF-16

The way strings are stored internally doesn't really matter.

While Perl stores unicode strings internally as UTF-8 (or something very close to it), it can encode those strings to many other encodings for output.  The same holds for Java: while it stores strings internally as UTF-16, there's no problem creating UTF-8 output, for example.

Writer utf8out = new BufferedWriter( new OutputStreamWriter( new FileOutputStream("outfile"), "UTF-8" ) ); utf8out.write("some unicode data");