➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

作者 vstinner
收信人 amaury.forgeotdarc, bupjae, ezio.melotti, vstinner
日期 2009-02-03.11:34:19
SpamBayes Score 7.470691e-13
Marked as misclassified 否
Message-id <1233660862.06.0.142399707334.issue5127@psf.upfronthosting.co.za>
In-reply-to
内容
I don't understand the behaviour of unichr():

Python 2.7a0 (trunk:68963M, Jan 30 2009, 00:49:28)
>>> import unicodedata
>>> unicodedata.category(u"\U00010000")
'Lo'
>>> unicodedata.category(u"\U00011000")
'Cn'
>>> unicodedata.category(unichr(0x10000))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: unichr() arg not in range(0x10000) (narrow Python build)

Why unichr() fails whereas \Uxxxxxxxx works?

>>> len(u"\U00010000")
2
>>> ord(u"\U00010000")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: ord() expected a character, but string of length 2 found
历史
日期 用户 动作 参数
2009-02-03 11:34:22vstinner修改recipients: + vstinner, amaury.forgeotdarc, ezio.melotti, bupjae
2009-02-03 11:34:22vstinner修改messageid: <1233660862.06.0.142399707334.issue5127@psf.upfronthosting.co.za>
2009-02-03 11:34:20vstinner链接issue5127 messages
2009-02-03 11:34:19vstinner创建