[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Constructing java.lang.String in constant pool
From: |
Patrick Doyle |
Subject: |
Re: Constructing java.lang.String in constant pool |
Date: |
Thu, 28 Jun 2001 10:44:17 -0400 (EDT) |
On 28 Jun 2001, Brian Jones wrote:
> Patrick Doyle <address@hidden> writes:
>
> > The closest thing to sanity I can think of is to convert the UTF8-encoded
> > characters into a char array and then use the String(char[], length)
> > constructor. AFAIK I would have to implement the conversion myself.
> >
> > Does this seem like the right approach?
>
> I don't know if this matters, but your approach seems to ignore locale
> encoding.
Yes, I had considered that briefly, but the JVM spec doesn't mention
locale encoding in its description of the constant pool. A
CONSTANT_String entry points to a CONSTANT_Utf8 entry, and the conversion
of that to Unicode is described in the spec, section 4.4.7:
http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#7963
That appears to be all there is to the story. Am I missing something?
Thanks for your help.
--
Patrick Doyle
address@hidden