UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

Piet van Oostrum piet at cs.uu.nl
Fri Jul 17 04:47:36 EDT 2009


>>>>> akhil1988 <akhilanger at gmail.com> (a) wrote:

>a> Well, you were write: unintentionally I removed strip(). But the problem does
>a> not ends here:

>a> I get this error now:

>a>  File "./temp.py", line 488, in <module>
>a>     main()
>a>   File "./temp.py", line 475, in main
>a>     for line in sys.stdin:
>a>   File "/usr/local/lib/python3.1/codecs.py", line 300, in decode
>a>     (result, consumed) = self._buffer_decode(data, self.errors, final)
>a> UnicodeDecodeError: 'utf8' codec can't decode bytes in position 0-2: invalid
>a> data

>a> for this line:
>a> â

Your Python assumes stdin uses utf-8 encoding, probably because your
locale says so. But it seems the input is not really utf-8 but some
other encoding.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list