# HG changeset patch # User joehw # Date 1340749701 25200 # Node ID 7920ead2cc759678532ce09a4b96f20a10a0053b # Parent a079926a6d815256266163af52cff38be084474b 7166896: DocumentBuilder.parse(String uri) is not IPv6 enabled. It throws MalformedURLException Summary: skip the added international character handling for general paths Reviewed-by: lancea diff -r a079926a6d81 -r 7920ead2cc75 src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java --- a/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java Sun Jun 17 21:29:12 2012 -0700 +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java Tue Jun 26 15:28:21 2012 -0700 @@ -2609,6 +2609,18 @@ if (str == null) { return str; } + int len = str.length(), i=0, ch; + for (; i < len; i++) { + ch = str.charAt(i); + // if it's not an ASCII 7 character, break here, and use UTF-8 encoding + if (ch >= 128) + break; + } + + // we saw no non-ascii-7 character + if (i == len) { + return str; + } // get UTF-8 bytes for the string StringBuffer buffer = new StringBuffer(); @@ -2620,11 +2632,11 @@ // should never happen return str; } - int len = bytes.length; - int ch; + + len = bytes.length; // for each byte - for (int i = 0; i < len; i++) { + for (i = 0; i < len; i++) { b = bytes[i]; // for non-ascii character: make it positive, then escape if (b < 0) {