users@jaxb.java.net

Re: JAXB2 2.0.3 UTF-8 support

From: James Mao <james.mao_at_iona.com>
Date: Tue, 06 Feb 2007 19:48:09 +0800

Hi,

It's not the bug in jaxb, i actually suspect it's a problem in maven2, i
have use the same code and same xml file in ant project, it' works just
fine.
I guess it's a problem in my pom.xml or when maven run tests it load the
wrong xml parser, i'm not 100% sure though.

Thanks,
James.

> James Mao wrote:
>> Hi,
>>
>> I encounter a very strange problem with jaxb2 UTF-8 support,
>> I'm using JAXB 2.0.3, jdk 1.5.0_10-b03, the xml is in utf-8 encoding.
>>
>> The problem is:
>>
>> if the node or attribute contains *three* Chinese characters, the
>> unmarshall will fail with the exception message:
>>
>> [org.xml.sax.SAXParseException: Invalid byte 3 of 3-byte UTF-8
>> sequence.]
>
> I actually suspect that your data is incorrectly encoded. Decoding of
> UTF-8 to char[] is done by JDK, and I find it very unlikely that it
> has any bug.
>
>
>> If add another Chinese character (*four* Chinese characters), the
>> unmarshall works just fine.
>>
>> I don't know if it's a known issue in jaxb2? or maybe it's a bug in
>> the xml parser used by Jaxb2?
>>
>> Trying to upgrade to JAXB2 2.1.2, but seems the version is not
>> uploaded to the maven2 repository yet, any plan to upload the latest
>> version?
>
> It's never posted to m2 repository, but it's always in m1 repository. See
>
> https://maven-repository.dev.java.net/nonav/repository/com.sun.xml.bind/jars/
>
>
> You can access this from m2, too.
>