Oleg Broytmann wrote:
> On Wed, Apr 16, 2008 at 11:21:26PM +1000, Nick Coghlan wrote:
>> You get:
>>
>> >>> "тест"
>> 'тест'
>> >>> open("тест")
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "/home/ncoghlan/devel/py3k/Lib/io.py", line 212, in __new__
>> return open(*args, **kwargs)
>> File "/home/ncoghlan/devel/py3k/Lib/io.py", line 151, in open
>> closefd)
>> IOError: [Errno 2] No such file or directory: 'тест'
>
> Very well, then. Thank you! The code should be put in a cookbook or the
> wiki, if not in the library.
>
Unfortunately, it turns out that the trick also breaks display of
strings containing any other escape codes. For example:
>>> '\n'
'
'
>>> '\t'
' '
The unicode_escape codec is interpreting all of the escape sequences
recognised in Python strings, not just the \u sequences we're interested in.
I can't see an easy way around this at the moment, but I'm still
reasonably convinced that the issue of Unicode escapes for non-ASCII
users is best attacked as a display problem rather than an internal
representation problem.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com