Hi Joe, What happens if there is a space character or other characters in the string that should be encoded ?
http://greenbytes.de/tech/webdav/rfc2396.html#rfc.section.2.4.3 I suspect "escapeNonUSAscii" is slightly misleading, it should be really called something like "escapeCharactersInUriString". Note that '[' and ']' are not valid URI characters outside of an IPv6 encoded address. Paul. On Jun 23, 2012, at 1:09 AM, Joe Wang wrote: > Hi, > > This is a patch to fix the IPv6 issue. > > In a previous patch to fix an issue with system id containing international > characters, an extra character escaping was added so that any URL passed to > the parser goes through method escapeNonUSAscii before it's used to construct > an URL. > > However, literal IPv6 addresses are enclosed in square brackets. The > escapeNonUSAscii encoded address will become unrecognizable to URL that would > throw a java.net.MalformedURLException. An address such as > http://[fe80::la03:73ff:fead:f7b0]/note.xml is encoded as > http://%5Bfe80::la03:73ff:fead:f7b0%5D/note.xml", resulting in > java.net.MalformedURLException: For input string: ":la03:73ff:fead:f7b0%5D". > > This patch skips the encoding process and returns it as is if there're no > non-ascii characters. > > webrev: http://cr.openjdk.java.net/~joehw/7u6/7166896/webrev/ > > Please review. > > Thanks, > Joe