UTF-8 problem encoding and decoding in Python3

hidura at gmail.com hidura at gmail.com
Sun Oct 10 13:25:39 EDT 2010


Hello everybody i am trying to encode a file string of an upload file and i  
am facing some problems with the first part of the file. When i open  
directly and try to decode the file the error is this:  
`UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 0:  
unexpected code byte` here is the first part of the file:
`\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00C\x00\x08\x06\x06\x07\x06\x05\x08\x07\x07\x07\t\t\x08\n\x0c\x14\r\x0c\x0b\x0b\x0c`
but when i try to encode the file in the server the encode change the parts  
of the file and the result is  
this:`\xc3\xbf\xc3\x98\xc3\xbf\xc3\xa0\x00\x10JFIF` without say that the  
file doesn 't save correctly.

Any ideas?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20101010/96be66e3/attachment.html>


More information about the Python-list mailing list