Collation strength "primary" (case insensitive) reports 'Ø' and 'ø' different

XMLWordPrintable

    • x86_64
    • os_x

      ADDITIONAL SYSTEM INFORMATION :
      Mac OS X
      OpenJDK Runtime Environment Homebrew (build 11.0.28+0)
      OpenJDK 64-Bit Server VM Homebrew (build 11.0.28+0, mixed mode)


      A DESCRIPTION OF THE PROBLEM :
      Unicode characters u00D8 and u00F8 (Latin Capital/Small Letter O With Stroke) are only different in case (one lowercase, the other uppercase), and so should be considered equal when using Locale.ROOT and collation strength "primary". Similar to 'A' and 'a', for this strength.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      javac -encoding utf-8 Test.java
      java Test

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      With Collator.PRIMARY, Locale.ROOT
      'O' and 'o' are considered the same
      'Ö' and 'ö' are considered the same
      'Ø' and 'ø' are considered the same
      ACTUAL -
      With Collator.PRIMARY, Locale.ROOT
      'O' and 'o' are considered the same
      'Ö' and 'ö' are considered the same
      'Ø' and 'ø' are considered different

      ---------- BEGIN SOURCE ----------
      import java.text.Collator;
      import java.util.Locale;
      public class Test {
          public static void main(String... args) {
              Collator collator = Collator.getInstance(Locale.ROOT);
              collator.setStrength(Collator.PRIMARY);
              System.out.println("With Collator.PRIMARY, Locale.ROOT");
              System.out.println("'O' and 'o' are considered " +
                      (collator.compare("O", "o") == 0 ? "the same" : "different"));
              System.out.println("'Ö' and 'ö' are considered " +
                      (collator.compare("Ö", "ö") == 0 ? "the same" : "different"));
              System.out.println("'\u00D8' and '\u00F8' are considered " +
                      (collator.compare("\u00D8", "\u00F8") == 0 ? "the same" : "different"));
          }
      }
      ---------- END SOURCE ----------

            Assignee:
            Justin Lu
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: