You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/02/11 07:47:24 UTC
DO NOT REPLY [Bug 6356] New: -
Cannot produce consistent XML for "windows-1251" encoding
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6356>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6356
Cannot produce consistent XML for "windows-1251" encoding
Summary: Cannot produce consistent XML for "windows-1251"
encoding
Product: XalanJ2
Version: 2.2.0
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Normal
Priority: Other
Component: Xalan
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: ushakov@int.com.ru
I use Xalan 2.2.0 as DOM-to-XML serializer.
My wish is to get output encoded as "windows-1251", but I could only get two
different inconsistent results:
1. Desired output encoding in the output with wrong encoding declaration in
the XML header:
<?xml version="1.0" encoding="UTF-8"?>
2. The desired encoding declaration in the header with this encoding being
really absent in the output (all non-ascii output goes as &#NNNN;):
<?xml version="1.0" encoding="windows-1251"?>
<root><child>Это
тест</child></root>
The Java code fragment is:
TransformerFactory tFactory = TransformerFactory.newInstance ();
Transformer transformer = tFactory.newTransformer ();
// transformer.setOutputProperty (OutputKeys.ENCODING, "windows-1251");
DOMSource source = new DOMSource (document);
FileOutputStream fos = new FileOutputStream ("E:\\test.xml");
OutputStreamWriter out = new OutputStreamWriter (fos, "windows-1251" );
StreamResult result = new StreamResult (out);
transformer.transform (source, result);
With commented line remaining commented I get result #1, with uncommented -
result #2.
My environment is:
- Windows 2000 Prof with Russian locale
- JDK 1.3.1_01
Regards,
Sergey Ushakov