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

string comparison errors in Scandinavian collators

XMLWordPrintable

    • sparc
    • solaris_2.5.1



      Name: laC46010 Date: 10/19/97



      Collator for da_DK(Danish-Denmark) Locale doesn't compare
      certain characters correctly.
      The following comparisons should be true:

      Strength Comparison
      PRIMARY : "\u007a" < "\u00e6"
      SECONDARY: "\u00e6" = "a\u0308"
      SECONDARY: "a\u0308" = "\u00c6"
      TERTIARY : "a\u0308" < "\u00c6"
      SECONDARY: "\u00c6" = "A\u0308"

      according to order specified in
      src/share/classes/java/text/resources/LocaleElements_da.java:

      " & Z < \u00e6, a\u0308 , \u00C6, A\u0308"

      However JDK1.2 produces false for all of them using the following
      localizations:
      da_DK, no_no, no_NO_B and sv_SE

      The following tests are failed due to this error:

      api/java_util/localeData/secondaryLocale.html#da_DK_Collator,
      api/java_util/localeData/secondaryLocale.html#no_NO_Collator,
      api/java_util/localeData/secondaryLocale.html#no_NO_B_Collator,
      api/java_util/localeData/secondaryLocale.html#sv_SE_Collator.
       
      An example below produces the following output:
      --------------output----------------
      failed: a\u0308 >= \u00c6

      --------------Coll_DA_DK_fails.java--------------------
      import java.util.Locale;
      import java.text.Collator;

      class Coll_DA_DK_fails {

          public static void main(String argv[]) {
      Locale da = new Locale("da", "DK");
      Collator col = Collator.getInstance(da);

      col.setStrength(Collator.TERTIARY);
      if (col.compare("\u0061\u0308", "\u00c6") >= 0) {
      System.out.println("failed: a\\u0308 >= \\u00c6");
      } else {
      System.out.println("OK");
      }
          }
      }

      ---------------------------------------------------------

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

            joconnersunw John Oconner (Inactive)
            leosunw Leo Leo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: