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

Change in behavior with -Djava.locale.useOldISOCodes=true

XMLWordPrintable

    • b10
    • Verified

      Starting in JDK 23, the following program behaves differently when -Djava.locale.useOldISOCodes=true is set.

      ```
      import java.util.List;
      import java.util.Locale;

      class T {
        public static void main(String[] args) {
          for (String l : List.of("iw", "fa", "iw")) {
            Locale locale = new Locale(l);
            Locale.setDefault(locale);
            String displayName = locale.getDisplayName();
            System.err.println(locale);
            System.err.println(displayName);
            System.err.println(Character.getDirectionality(displayName.charAt(0)));
          }
        }
      }
      ```

      $ java -fullversion
      openjdk full version "22.0.2+9-70"
      $ java -Djava.locale.useOldISOCodes=true T
      iw
      עברית
      1
      fa
      فارسی
      2
      iw
      עברית
      1

      $ java -fullversion
      openjdk full version "23-ea+34-2361"
      $ java -Djava.locale.useOldISOCodes=true T
      iw
      Hebrew
      0
      fa
      فارسی
      2
      iw
      Hebrew
      0

            naoto Naoto Sato
            cushon Liam Miller-Cushon
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: