Unicode

Duncan Booth duncan.booth at invalid.invalid
Fri Mar 15 07:02:49 EDT 2013


Thomas Heller <theller at ctypes.org> wrote:

><output>
> æm
> Traceback (most recent call last):
>    File "x.py", line 7, in <module>
>      print(b)
>    File "C:\Python33-64\lib\encodings\cp850.py", line 19, in encode
>      return codecs.charmap_encode(input,self.errors,encoding_map)[0]
> UnicodeEncodeError: 'charmap' codec can't encode character '\u03bc' in 
> position 0: character maps to <undefined>
></output>
> 
> Using (german) windows, command prompt, codepage 850.
> 
> The same happens with Python 2.7.  What am I doing wrong?
> 

They are different characters:

>>> repr(a)
"u'\\xb5m'"
>>> repr(b)
"u'\\u03bcm'"

a contains unicode MICRO SIGN, b contains GREEK SMALL LETTER MU

-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list