sboag 99/12/17 17:28:54
Modified: src/org/apache/xalan/xpath/xml FormatterToXML.java
Log:
Bug fix: FormatterToXML#getMimeEncoding returns NULL. Many thanks goes to
"Dmitry Volpyansky" <[EMAIL PROTECTED]>. I now just output the system encoding
if an encoding can not be found.
Revision Changes Path
1.16 +28 -15
xml-xalan/src/org/apache/xalan/xpath/xml/FormatterToXML.java
Index: FormatterToXML.java
===================================================================
RCS file:
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/xml/FormatterToXML.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- FormatterToXML.java 1999/12/16 21:20:19 1.15
+++ FormatterToXML.java 1999/12/18 01:28:53 1.16
@@ -467,7 +467,11 @@
}
catch(Exception e3)
{
- System.out.println("Java VM does not support encoding:
"+m_encoding+" or "+javaEncoding);
+ System.out.print("Java VM does not support encoding: "+m_encoding);
+ if(null != javaEncoding)
+ System.out.println(" or "+javaEncoding);
+ else
+ System.out.println();
osw = new OutputStreamWriter(output);
}
}
@@ -1725,23 +1729,32 @@
// incorrect if they passed in a writer, but right now there
// seems to be no way to get the encoding from a writer.
encoding = System.getProperty("file.encoding");
-
- /*
- * See if the mime type is equal to UTF8. If you don't
- * do that, then convertJava2MimeEncoding will convert
- * 8859_1 to "ISO-8859-1", which is not what we want,
- * I think, and I don't think I want to alter the tables
- * to convert everything to UTF-8.
- */
- encoding = (encoding.equals("Cp1252") ||
- encoding.equals("ISO8859_1") ||
- encoding.equals("8859_1") ||
- encoding.equals("UTF8"))
- ? "UTF-8" : FormatterToXML.convertJava2MimeEncoding(
encoding );
+
+ if(null != encoding)
+ {
+ /*
+ * See if the mime type is equal to UTF8. If you don't
+ * do that, then convertJava2MimeEncoding will convert
+ * 8859_1 to "ISO-8859-1", which is not what we want,
+ * I think, and I don't think I want to alter the tables
+ * to convert everything to UTF-8.
+ */
+ String jencoding = (encoding.equals("Cp1252") ||
+ encoding.equals("ISO8859_1") ||
+ encoding.equals("8859_1") ||
+ encoding.equals("UTF8"))
+ ? DEFAULT_MIME_ENCODING :
FormatterToXML.convertJava2MimeEncoding( encoding );
+ if(null != jencoding)
+ encoding = jencoding;
+ }
+ else
+ {
+ encoding = DEFAULT_MIME_ENCODING;
+ }
}
catch(SecurityException se)
{
- encoding = "UTF-8";
+ encoding = DEFAULT_MIME_ENCODING;
}
}
return encoding;