Name: mt13159 Date: 04/23/2001
This is not a JDK version specific bug.
URLEncoder.encode(String s) method and URLDecoder.decode(String s) method
provide functionality to encode/escape URL parameters based on RFC2396
section 2.4. The problem in these two methods in these classes they use
the default encoding of java runtime environment. HTML appliations
usually have to deal with variety of character encodings in HTTP requests
and responses.
As a result, these classes are unusable in real world and also causes
a lot of problems in other java and servlet/jsp classes that use this
method.
I'd like to request Sun to provide following addition methods for both
classes.
java.net.URLEncoder
public static String encode(String s, String enc)
java.net.URLDecoder
public static String decode(String s, String enc)
'String s' is the string need to be encoded and decoded.
'String enc' is the encoding name that be used to encode and
decode.
I put enhanced URLEncoder and URLDecoder classes in Work Around
section. Please see.
(Review ID: 121149)
======================================================================
- duplicates
-
JDK-4257115 URLEncoder and URLDecoder should support target character sets
- Resolved