Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JAXB: Encoding error (Malformed UTF-8, trying to set ISO)

843834Feb 7 2003 — edited Feb 10 2003
Hi, I get this error when doing a Unmarshaller.unmarshal( anURL );
DefaultValidationEventHandler: [WARNING]: Declared encoding "ISO-8859-1" does not match actual one "UTF-8"; this might not be an error.
DefaultValidationEventHandler: [FATAL_ERROR]: Character conversion error: "Malformed UTF-8 char -- is an XML encoding declaration missing?" (line number may be too low).
org.xml.sax.SAXParseException: Character conversion error: "Malformed UTF-8 char -- is an XML encoding declaration missing?" (line number may be too low).
	at org.apache.crimson.parser.InputEntity.fatal(InputEntity.java:1100)
(...) etc..
So far, I set the ISO-8859-1 encoding 4 places;
1. the xml response from the servlet: xml.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n")
2. the original XSD which the JAXB classes was generated from
3. In the client, after recieving the string containing the XML: bytes b[] = xmlString.getBytes("ISO-8859-1");
4. In the client; when posting to the server: httpConn.setRequestProperty("Content-Type","text/xml;charset=ISO-8859-1");

Yet, JAXB still thinks I'm doing UTF-8 here! Did I forget something?

thanks,

bjorn
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 10 2003
Added on Feb 7 2003
1 comment
440 views