converting ß.cfg to upper case using toUpperCase() in java

前端 未结 5 1340
心在旅途
心在旅途 2021-01-18 05:47

I am trying following code

String s1 = \"ß.cfg\";
System.out.println (s.toUpperCase());

output I am getting is SS.CFG since U

5条回答
  •  春和景丽
    2021-01-18 06:22

    The Java implementation is simply following what the Unicode specification says. And Unicode says this:

    # ================================================================================
    # Unconditional mappings
    # ================================================================================
    
    # The German es-zed is special--the normal mapping is to SS.
    # Note: the titlecase should never occur in practice. It is equal to titlecase(uppercase())
    
    00DF; 00DF; 0053 0073; 0053 0053; # LATIN SMALL LETTER SHARP S
    

    Reference: http://unicode.org/Public/UNIDATA/SpecialCasing.txt

    If you want to implement a form of uppercase conversion that is different to Unicode, you'll need to specify and implement it yourself.


    (If you want to see a bunch of people getting hot under the collar about "uppercase ß", read this email thread - http://unicode.org/mail-arch/unicode-ml/y2007-m05/0007.html )

提交回复
热议问题