Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4449371

URLEncoder and URLDecoder requires encoding support other than the default one

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.0
    • core-libs
    • generic
    • generic



      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)
      ======================================================================

            michaelm Michael McMahon
            mthakore Mayank Thakore (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: