Character Encodings and display of strings

Diez B. Roggisch deets at nospam.web.de
Mon Nov 13 11:07:39 EST 2006


JKPeck wrote:

> Thanks for the quick answer.  I thought repr was involved here, but
> when I use repr explicitly I get a notation where the backslashes are
> escaped.  I also though that with the encoding explictily declared in
> the source, that repr would take that into account and use the
> character form, but obviously it doesn't.

The encoding in the source has nothing to do with that. How should an
encoding (and possibly a gazillion different ones in gazillion other
sourcefiles of yours) influence the list repr code?

The encoding in the source-file is solely used to correctly parse unicode
literals, as these need a specific encoding to be generated from the
byte-string they are in the sourcecode.

Diez



More information about the Python-list mailing list