特殊汉字比较 [英] special Chinese characters comparison

查看:90
本文介绍了特殊汉字比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

。比较两个字符李,李时有些误解。

. There are something misunderstanding when comparing two characters "李","李".

>>> "李" == "李"
False

>>> id("李") # fisrt one
140041303457584

>>> id("李") # second one
140041303457584

。第一个字符李 ID等于第二个李 ID,但是当我尝试比较其ID以查看会发生什么情况时:

. The first character "李" id is equal to the second "李" id, but when i try to compare their id to see what happen:

>>> id("李") == id("李")
False

。但是,我尝试使用Chrome Ctrl + F搜索第一个李并匹配第二个李。

. However, I tried to use chrome "Ctrl + F" that searching the first "李" and matched the second "李".

。有人知道会发生什么吗?我应该怎么做才能解决这个问题,让第一个李等于第二个李?

. Does anyone know what happens? what should I do to fix this let the first "李" equal to the second "李"?

推荐答案

我认为两个字符看起来相同只是一个巧合。
例如:

I think it's just a coincidence that two character looks the same. like:

>>> "ᴀ" == "A"
False
>>> "С" == "C"
False

访问 unicode表,您会发现第一个字符(unicode:674e)是中文的普通字符,第二个字符(unicode:f9e1)是一个看起来很特殊的字符像s阿美但是它们确实是不同的字符。

Visit unicode table, and you will find that the first character(unicode: 674e) is the normal character of Chinese, the second one(unicode: f9e1) is a special character that happends to look like the same. But they are indeed different characters.

这篇关于特殊汉字比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆