How to compare Unicode characters that “look alike”?

前端 未结 10 1136
情歌与酒
情歌与酒 2020-11-27 10:42

I fall into a surprising issue.

I loaded a text file in my application and I have some logic which compares the value having µ.

And I realized that even if

10条回答
  •  Happy的楠姐
    2020-11-27 11:24

    Search both characters in a Unicode database and see the difference.

    One is the Greek small Letter µ and the other is the Micro Sign µ.

    Name            : MICRO SIGN
    Block           : Latin-1 Supplement
    Category        : Letter, Lowercase [Ll]
    Combine         : 0
    BIDI            : Left-to-Right [L]
    Decomposition   :  GREEK SMALL LETTER MU (U+03BC)
    Mirror          : N
    Index entries   : MICRO SIGN
    Upper case      : U+039C
    Title case      : U+039C
    Version         : Unicode 1.1.0 (June, 1993)
    

    Name            : GREEK SMALL LETTER MU
    Block           : Greek and Coptic
    Category        : Letter, Lowercase [Ll]
    Combine         : 0
    BIDI            : Left-to-Right [L]
    Mirror          : N
    Upper case      : U+039C
    Title case      : U+039C
    See Also        : micro sign U+00B5
    Version         : Unicode 1.1.0 (June, 1993)
    

提交回复
热议问题