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

German umlaut broken in Path.toUri()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • tbd
    • None
    • core-libs

      The following sample code demostrates the problem of Path.toUri(). It encodes umlaut incorrectly as 117,776.

      import java.io.File;
      import java.io.IOException;
      import java.net.MalformedURLException;
      public class Test {
          public static void main(String[] args) throws MalformedURLException, IOException {
              final File f = new File ("Frühling").getCanonicalFile(); //NOI18N
              f.mkdir();
              final String io = f.toURI().toURL().toString();
              final String nio = f.toPath().toUri().toURL().toString();
              final boolean res = io.equals(nio);
              System.out.println(res);
              System.out.println(io);
              System.out.println(nio);
          }
      }

      On Ubuntu with JDK 8 the same problem as on Mac, seems a problem in UNIX implementation of NIO FileSystem.

      Related NetBeans bug:
      https://netbeans.org/bugzilla/show_bug.cgi?id=246438

            bpb Brian Burkhalter
            anebuzel Antonín Nebuželský
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: