You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by "Saigal, Ankur" <an...@sap.com> on 2002/01/02 11:08:01 UTC

UTF-16 encoding

Hi All,

Problem:
 Some junk characters are written out after transformation while using
UTF-16 encoding.

Description :
I get the "Transformer" object from the TransformerFactory and then set the
output property ("encoding") as "UTF-16".

                transformer.setOutputProperty("encoding","UTF-16")

After this the result which I get carries 2 junk charcters ("ÿþ<") before
the actual expected stuff.



Can someone suggest me a solution for this problem?

Thanks and Regards,
Ankur

PS : The incoming document is normal UTF-8 encoded.Can this be an issue ??

RE: UTF-16 encoding

Posted by Gary L Peskin <ga...@firstech.com>.
This is probably the UTF-16 Byte Order Mark (BOM).  If you can look at
this in hex, it would be helpful.  The BOM is FEFF for big-endian byte
order and FFFE for little-endian byte order.  Any UTF-16 display tool
should be aware of the BOM.

Gary

> -----Original Message-----
> From: Saigal, Ankur [mailto:ankur.saigal@sap.com] 
> Sent: Wednesday, January 02, 2002 2:08 AM
> To: xalan-j-users@xml.apache.org
> Subject: UTF-16 encoding
> 
> 
> Hi All,
> 
> Problem:
>  Some junk characters are written out after transformation 
> while using UTF-16 encoding.
> 
> Description :
> I get the "Transformer" object from the TransformerFactory 
> and then set the output property ("encoding") as "UTF-16".
> 
>                 transformer.setOutputProperty("encoding","UTF-16")
> 
> After this the result which I get carries 2 junk charcters 
> ("ÿþ<") before the actual expected stuff.
> 
> 
> 
> Can someone suggest me a solution for this problem?
> 
> Thanks and Regards,
> Ankur
> 
> PS : The incoming document is normal UTF-8 encoded.Can this 
> be an issue ??
>