[issue14176] Fix unicode literals

Georg Brandl report at bugs.python.org
Sat Mar 3 14:03:38 CET 2012

Georg Brandl <georg at python.org> added the comment:

I'd like to encourage you to not try this sort of thing out from an interactive interpreter (incidentally, where does "<psi last command>" come from? It doesn't look like Python's REPL).

As David and Terry noted, interactions with such a console, be it Windows' "cmd" or IDLE, have their very own idiosyncrasies and bugs.

That said, in Python 2.x *source files* the following two expressions are identical:

* u'abcœé€'
* unicode('abcœé€', 'encoding the file is in')

Both result in a Unicode string with the six characters/codepoints you mentioned.  There won't be any code that works with one but not the other.

Of course there are libraries that do not handle Unicode strings in general (nothing to do with literals!) correctly, but as you yourself said, that is a problem with the libraries.

Lastly, please read PEP 414 if you are not completely sure what it is proposing.  You will see that it merely affects the available syntax for Unicode literals and allows the "u" again.


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list