【发布时间】:2013-10-02 13:57:23
【问题描述】:
使用 python 2.7:
>myCity = 'Isparta'
>myCity.lower()
>'isparta'
#-should be-
>'ısparta'
尝试了一些解码,(例如,myCity.decode("utf-8").lower()) 但找不到如何做到这一点。
怎样才能降低这种字母? ('I' > 'ı', 'İ' > 'i' 等)
编辑:在土耳其语中,“I”的小写字母是“ı”。 'i'的大写是'İ'
【问题讨论】:
-
那是 ASCII 大写字母吗?如果它是一些 看起来 像 ASCII 字符的非 ASCII 字符,最好明确地命名它(例如,通过包含代码点)。
-
是ASCII大写字母I。
-
@KenB:例如土耳其语。这就是为什么这种文化是a common test for i18n-proofing code that compares user input with string literals。
-
@Jeff Atwood 曾经写过这篇文章,你最好阅读一下this article 另外,我猜这是关于土耳其语言环境的最佳文章。
-
那真是太有趣了。我今天学了些新东西。 @FallenAngel,很棒的链接
标签: python unicode encoding utf-8