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.
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi_at_sun.com