string1.equalsIgnoreCase(string2) differs from string1.toUpperCase().equals(stri

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P3
    • None
    • Affects Version/s: 1.2.0
    • Component/s: core-libs
    • generic
    • solaris_2.5.1


      A German licensee has reported problems with our handling of the small sharp s (\u00DF) in our String class. In particular the equalsIgnoreCase method doesn't handle this character.

      Here is an example to duplicate the problem :-

      class test {
          public static void main(String[] args) {

              String string1 = "abc\u00DF";
              String string2 = string1.toUpperCase();

              if (string1.equalsIgnoreCase(string2))
                  System.out.println("equalsIgnoreCase says they are equal");

              if (string1.toUpperCase().equals(string2.toUpperCase()))
                  System.out.println("equals says they are equal");


          }
      }

      The issue is that toUpperCase converts \00DF to SS but this is not taken into account by the internal regionMatches method.




            Assignee:
            Michael Mccloskey (Inactive)
            Reporter:
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: