[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit ReceivedPage.java,1.11,1.12
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2001-02-02 14:34:26
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv5293/src/com/meterware/httpunit
Modified Files:
ReceivedPage.java
Log Message:
Accomodate UTF8 encoding name in JDK 1.1.x
Index: ReceivedPage.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/ReceivedPage.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ReceivedPage.java 2000/12/27 20:02:17 1.11
+++ ReceivedPage.java 2001/02/02 14:34:29 1.12
@@ -59,7 +59,7 @@
private static Node getDOM( String pageText ) throws SAXException {
try {
- return getParser().parseDOM( new ByteArrayInputStream( pageText.getBytes( "UTF-8" ) ), null );
+ return getParser().parseDOM( new ByteArrayInputStream( pageText.getBytes( getUTFEncodingName() ) ), null );
} catch (UnsupportedEncodingException e) {
throw new RuntimeException( "UTF-8 encoding failed" );
}
@@ -67,6 +67,18 @@
//---------------------------------- private members --------------------------------
+
+
+ private static String _utfEncodingName;
+
+ private static String getUTFEncodingName() {
+ if (_utfEncodingName == null) {
+ String versionNum = System.getProperty( "java.version" );
+ if (versionNum.startsWith( "1.1" )) _utfEncodingName = "UTF8";
+ else _utfEncodingName = "UTF-8";
+ }
+ return _utfEncodingName;
+ }
private void setBaseAttributes() throws SAXException {
|