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

URLEncoder.encode() doesn't work with non-ASCII characters

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1fcs
    • CPU:
      generic, sparc
    • OS:
      generic, solaris_2.5
    • Verification:
      Not verified

      Description

       
      masayoshi.okutsu@Eng 1997-01-14
      URLEncoder.encode() doesn't support non-ASCII Unicode characters. The
      expected behavior is to convert Unicode characters to external encoding
      (default), then to URL encode.

      The following test program outputs (inclusing EUCJIS characters):

           ã³“›©ý
           ã³“›©ý
           %e5%2c%9e
           %e5%2c%9e

      but expected:

           %c6%fc%cb%dc%b8%ec

      for the two bottom lines.

      import java.net.*;
      public class URLEncoder_test {
         public static void main(String[] args) {
            System.out.println("㳓›©ý") ;
            System.out.println("\u65e5\u672c\u8a9e") ;
            System.out.println(URLEncoder.encode("㳓›©ý")) ;
            System.out.println(URLEncoder.encode("\u65e5\u672c\u8a9e")) ;
         }
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              nishimur Naoyuki Ishimura (Inactive)
              Reporter:
              okutsu Masayoshi Okutsu
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: