John O'Conner wrote:

> Within a String, the encoding of char values is practically irrelevant. It is a
> hidden encoding that is never exposed to the user...or developer. When you access
> String char values, you use an index to 16-bit Unicode values. To my knowledge,
> Sun does not claim that its internal encoding of String is UTF-8 in any of its API
> documentation.

The internal encoding is exposed by the regrettably named readUTF and
writeUTF methods of java.io.Data{Input,Output}Stream, which should have
been named readString and writeString.  People have assumed that they
are general-purpose UTF-8 read/write functions.

At one point, this was a FAQ on this list.


-- 
There is / one art             || John Cowan <[EMAIL PROTECTED]>
no more / no less              || http://www.reutershealth.com
to do / all things             || http://www.ccil.org/~cowan
with art- / lessness           \\ -- Piet Hein

Reply via email to