admin@glassfish.java.net

Re: Properties with multibyte characters

From: Tom Mueller <tom.mueller_at_oracle.com>
Date: Wed, 08 Dec 2010 17:13:05 -0600

  Well, the DomainXmlPersistence class has the following line:

writer = xmlFactory.createXMLStreamWriter(new BufferedOutputStream(fos));

where xmlFactory is the result of calling XMLFactory.newInstance().

The javadocs for XMLOutputFactory are deficient in defining what
encoding is used here. There is another createXMLStreamWriter method
that takes the encoding as the second argument. So I suspect that the
encoding you are getting is not UTF-8, but some other encoding that
doesn't support multibyte characters.

Tom

On 12/8/2010 4:19 PM, Jason Lee wrote:
> I'm looking at this issue ATM:
> http://java.net/jira/browse/GLASSFISH-13641
>
> In short, if the user enters a multibyte value for a property name,
> value, or description, it gets mangled when saved. I've verified that
> the multibyte character String is passed correctly
> browser->console->rest. In our REST code, we have this line of code:
>
> ConfigSupport.createAndSet((ConfigBean) parent, Property.class,
> property);
>
> At this point, property is a Map with the correct
> name/value/description values. However, somewhere inside (or beyond)
> createAndSet(), the MB char String is mangled. It's possible, I
> guess, that it could be an XML issue, and therein lies my question:
> What do we need to do to allow the user to save a MB character
> String? Is our REST code interacting with the HK2 DOM correctly? I
> grepped what I felt might be likely places elsewhere in the GF tree,
> but I can't find any similar scenarios.
>
> Any pointers would be much appreciated.
>