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 Thomas Börkel <tb...@ap-ag.com> on 2002/10/08 11:03:52 UTC

RE: Transformer uses correct encoding, but does not write UTF-8 marker intofile

HI!

It's Notepad from Windows 2000.

Regards,
Thomas

> -----Original Message-----
> From: David N Bertoni/Cambridge/IBM 
> [mailto:david_n_bertoni@us.ibm.com] 
> Sent: Dienstag, 24. September 2002 17:45
> To: xalan-j-users@xml.apache.org
> Subject: Re: Transformer uses correct encoding, but does not 
> write UTF-8 marker intofile
> 
> 
> 
> 
> 
> 
> 
> There is no real need for a UTF-8 BOM, so most XML processing 
> systems don't
> write one.  What software are you using that requires one?
> 
> Dave
> 
> 
> 
>                                                               
>                                                               
>            
>                       Thomas Börkel                           
>                                                               
>            
>                       <tb...@ap-ag.com>           To:      
> "Xalan Mailinglist" <xa...@xml.apache.org>            
>                  
>                                                cc:      (bcc: 
> David N Bertoni/Cambridge/IBM)                                
>            
>                       09/24/2002 01:18         Subject: 
> Transformer uses correct encoding, but does not write UTF-8 
> marker into file   
>                       AM                                      
>                                                               
>            
>                                                               
>                                                               
>            
>                                                               
>                                                               
>            
> 
> 
> 
> HI!
> 
> I am writing an XML DOM to a file, using UTF-8 encoding. The 
> encoding is
> OK, the XML declaration is there, but the leading UTF-8 
> markers are missing
> in the file. Is this a bug or how can this be achieved? Thanks!
> 
> This is the code:
> 
>     TransformerFactory tFactory;
>     Transformer transformer;
>     StreamResult streamResult;
> 
>     tFactory = TransformerFactory.newInstance();
>     transformer = tFactory.newTransformer();
>     transformer.setOutputProperty(OutputKeys.ENCODING, encoding);
>     streamResult = new StreamResult(file);
>     transformer.transform(new DOMSource(node), streamResult);
> 
> 
> Regards,
> Thomas
> 
> 
> 
> 
>