-
Bug
-
Resolution: Not an Issue
-
P3
-
5.0
-
x86
-
windows_2000
FULL PRODUCT VERSION :
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Wondows 2000
A DESCRIPTION OF THE PROBLEM :
in the class
com.sun.org.apache.xml.internal.serializer.Encoding
the variable
SUN_CHAR2BYTE_CONVERTER_METHOD ist always null, because
the method findCharToByteConverterMethod() returns always with null.
That is because that the Transtormer class makes the serialization wrong if the
encoding is not utf-8.
If I set the encoding windows-1252 and try to serialize an xml , in witch there is
an euro character . The euro charactre will be serialzed as €.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. make an xml whch consists euro characters as tagvalue an as cddata value
2. load the xml into aone dom document
3. make a tranfomerfactory in this way
Transformer tr = TransformerFactory.newInstance().newTransformer();
tr.setOutputProperty(OutputKeys.INDENT,"yes");
tr.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,"yes");
tr.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "3");
tr.setOutputProperty(OutputKeys.ENCODING,"windows-1252");
4. try to serialize the document
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
in the serialized document the euro character is € but
should be 0x80
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
if I change the source of com.sun.org.apache.xml.internal.serializer.Encoding
private static Method findCharToByteConverterMethod() {
/*
try
{
System.err.println("findCharToByteConverterMethod 00");
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
try {
System.err.println("findCharToByteConverterMethod 01");
Class charToByteConverterClass = (Class)
Class.forName("sun.io.CharToByteConverter");
Class argTypes[] = {String.class};
System.err.println("findCharToByteConverterMethod 02 "+charToByteConverterClass.getMethod("getConverter", argTypes));
return charToByteConverterClass.getMethod("getConverter", argTypes);
}
catch (Exception e) {
e.printStackTrace(System.err);
throw new RuntimeException(e.toString());
}
}});
}
catch (Exception e)
{
System.err.println(
"Warning: Could not get charToByteConverterClass!");
}
return null;
*/
try{
Class charToByteConverterClass = (Class)
Class.forName("sun.io.CharToByteConverter");
Class argTypes[] = {String.class};
return charToByteConverterClass.getMethod("getConverter", argTypes);
}catch(Exception e){
return null;
}
}
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Wondows 2000
A DESCRIPTION OF THE PROBLEM :
in the class
com.sun.org.apache.xml.internal.serializer.Encoding
the variable
SUN_CHAR2BYTE_CONVERTER_METHOD ist always null, because
the method findCharToByteConverterMethod() returns always with null.
That is because that the Transtormer class makes the serialization wrong if the
encoding is not utf-8.
If I set the encoding windows-1252 and try to serialize an xml , in witch there is
an euro character . The euro charactre will be serialzed as €.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. make an xml whch consists euro characters as tagvalue an as cddata value
2. load the xml into aone dom document
3. make a tranfomerfactory in this way
Transformer tr = TransformerFactory.newInstance().newTransformer();
tr.setOutputProperty(OutputKeys.INDENT,"yes");
tr.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,"yes");
tr.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "3");
tr.setOutputProperty(OutputKeys.ENCODING,"windows-1252");
4. try to serialize the document
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
in the serialized document the euro character is € but
should be 0x80
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
if I change the source of com.sun.org.apache.xml.internal.serializer.Encoding
private static Method findCharToByteConverterMethod() {
/*
try
{
System.err.println("findCharToByteConverterMethod 00");
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
try {
System.err.println("findCharToByteConverterMethod 01");
Class charToByteConverterClass = (Class)
Class.forName("sun.io.CharToByteConverter");
Class argTypes[] = {String.class};
System.err.println("findCharToByteConverterMethod 02 "+charToByteConverterClass.getMethod("getConverter", argTypes));
return charToByteConverterClass.getMethod("getConverter", argTypes);
}
catch (Exception e) {
e.printStackTrace(System.err);
throw new RuntimeException(e.toString());
}
}});
}
catch (Exception e)
{
System.err.println(
"Warning: Could not get charToByteConverterClass!");
}
return null;
*/
try{
Class charToByteConverterClass = (Class)
Class.forName("sun.io.CharToByteConverter");
Class argTypes[] = {String.class};
return charToByteConverterClass.getMethod("getConverter", argTypes);
}catch(Exception e){
return null;
}
}