Hi,
 
I am marshalling an object to xml with the following code:
 
      StringWriter writer = new StringWriter ();
      Marshaller marshaller = new Marshaller ( writer );
      marshaller.setEncoding("UTF-16");
      marshaller.marshal( obj );
      return writer.toString();
 
The resulting string of xml is usually displayed in a browser (in this case IE5 and 6), but using UTF-16 causes this error:
 

Switch from current encoding to specified encoding not supported. Line 1, Position 40

<?xml version="1.0" encoding="UTF-16"?>

 
Okay, so it is probably IE, but I found this about this error message:
 
Switch from current encoding to specified encoding not supported.

You will get this error message if your file was saved as Unicode/UTF-16 but the encoding attribute specified a single-byte encoding like Windows-1252, ISO-8859-1 or  UTF-8. You can also get this error message if your document was saved with single-byte encoding, but the encoding attribute specified a double-byte encoding like UTF-16.

 

Using encoding ISO-8859-1 it works fine.

Any ideas?

Cheers,

Adam


=====================================================
 
Tel:   (+44) 117 908 1254 (Direct)
Mobile (+44) 7780 962 961
email: [EMAIL PROTECTED]
 
This communication is intended solely for the addressee and is confidential.
If you are not the intended recipient, any disclosure, copying, distribution
or any action taken or omitted to be taken in reliance on it, is prohibited
and may be unlawful.
 
Although this e-mail and any attachments are believed to be free of any
virus, or any other defect which might affect any computer or IT system into
which they are received and opened, it is the responsibility of the
recipient to ensure that they are virus free and no responsibility is
accepted by Multicom Products Limited for any loss or damage arising in any
way from receipt or use thereof.

Reply via email to