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

URL.openConnection() works wrong for Cp037

XMLWordPrintable

    • beta
    • generic, sparc
    • generic, solaris_2.5



      Name: dsC58869 Date: 02/10/2000


      The method
      java.net.URL.openConnection() hangs up the Java VM
      when character encoding is not ASCII (e.g. Cp037).

      Here is a minimized test:
      public class URLTest05 {
      public static void main(String[] args) {
      try {
                      String str = "http://www.sparc.spb.su/index.html";
                      System.out.println(str);
                      InputStreamReader isr = new InputStreamReader(System.in);
                      System.out.println(isr.getEncoding());
                      System.out.flush();
      URL url = new URL(str);
                      URLConnection conn = url.openConnection();
                      conn.getInputStream();
      System.out.println("OKAY");
      } catch (Exception e) {
      e.printStackTrace();
      }
      }
      }

      Output:
      %echo $LANG
      C
      %java URLTest05
      http://www.sparc.spb.su/index.html
      ISO8859_1
      OKAY
      %java -Dfile.encoding=Cp037 URLTest05
      êúúùzaaªªªKóùüÖâKóùéKóñaëòäàºKêúöô§Èù^T^?M-^U§
      ^C
      It means (converted from Cp037 to ASCII):
      http://www.sparc.spb.su/index.html
      Cp037

      ======================================================================

            michaelm Michael McMahon
            sdasunw Sda Sda (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: