Uploaded image for project: 'Commons Codec'
  1. Commons Codec
  2. CODEC-25

[Codec] Default URL encoding logic broken

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2
    • 1.3
    • None
    • Operating System: All
      Platform: All

    • 25995

    Description

      It looks like there are some changes made to the URLCodec class(rev 1.7 and 1.8)
      that do not seem quite right (in my opinion).

      http://cvs.apache.org/viewcvs.cgi/jakarta-commons/codec/src/java/org/apache/commons/codec/net/URLCodec.java?r1=1.7&r2=1.9

      The ENCODING variable in my original patch was made final static for a good
      reason. It is not supposed to be anything but US-ASCII. After all, the whole
      point of URL encoding is to represent non-ASCII data using a limited set of
      ASCII characters only, hence, 'US-ASCII' as a final static variable ENCODING.
      With the present code, if US-ASCII incompatible encoding is used (such as
      UTF-16, EBCDIC), URLCodec may produce erroneous results. I understand that the
      intention of the revision 1.7 & 1.8 was to allow for user defined default
      encoding, but in its present form URLCodec does not seem to produce the desired
      results.

      The patch I am about to attach should take care of the problem while retaining
      the existing (intended) semantics of the URLCodec class.

      Oleg

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--urlcodec.patch
          2 kB
          Oleg Kalnichevski
        2. ASF.LICENSE.NOT.GRANTED--codectest.patch
          0.9 kB
          Oleg Kalnichevski

        Activity

          People

            Unassigned Unassigned
            olegk Oleg Kalnichevski
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: