[Python-3000] Displaying strings containing unicode escapes
Oleg Broytmann
phd at phd.pp.ru
Wed Apr 16 16:33:22 CEST 2008
On Wed, Apr 16, 2008 at 07:26:36AM -0700, Guido van Rossum wrote:
> 2008/4/16 Oleg Broytmann <phd at phd.pp.ru>:
> > The problem manifests itself in scripts, too:
> >
> > Traceback (most recent call last):
> > File "./ttt.py", line 4, in <module>
> > open("тест") # filename is in koi8-r encoding
> > IOError: [Errno 2] No such file or directory: '\xd4\xc5\xd3\xd4'
>
> Note that this can be a feature too! You might have a filename that
> *looks* normal but contains a character from a different language --
> the \u encoding will show you the problem.
>
> $ ls *.py
> mc.py x.py
> guido-van-rossums-imac:~ guido$ python
> Python 2.5.2 (release25-maint:60953, Feb 25 2008, 09:38:08)
> [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> open('mс.py')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> IOError: [Errno 2] No such file or directory: 'm\xd1\x81.py'
This can be a feature only for people who always have all-ascii file
names and never expect non-ascii characters in the file names. Those of us
who regularly use non-ascii filenames are too accustomed to that
brok^H^H^H^H escaped repr's to spot a difference.
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-3000
mailing list