Python strings outside the 128 range

Gerhard Fiedler gelists at gmail.com
Thu Jul 13 10:41:36 EDT 2006


On 2006-07-13 07:42:51, Fredrik Lundh wrote:

>> Could anyone explain me how the python string "é" is mapped to
>> the binary code "\xe9" in my python interpreter ?
> 
> in the iso-8859-1 character set, the character é is represented by the code
> 0xE9 (233 in decimal).  there's no mapping going on here; there's only one
> character in the string.  how it appears on your screen depends on how you
> print it, and what encoding your terminal is using.

If I understand you correctly, you are saying that if I distribute a file
with the following lines:
 
  s = "é"
  print s

I basically need to distribute also the information how the file is encoded
and every user needs to use the same (or a compatible) encoding for reading
this file?

Is there a standard way to do this?

Gerhard
Gerhard




More information about the Python-list mailing list