UnicodeDecodeError issue

Dave Angel davea at davea.name
Mon Sep 2 08:21:45 EDT 2013


On 2/9/2013 07:49, Ferrous Cranus wrote:
    <snip>
> Στις 2/9/2013 2:38 μμ, ο/η Dave Angel έγραψε:
>>
>> Does that string make any sense to you?
>
> Yes it does, it mean "Unknown Hostname"
>
>> The Linux 'file' utility thinks this string is in ISO-8859, so you might
>> want to try a decode('ISO-8859-1') as well.  (and maybe  ISO-8859-2, -3,
>> -4, and -5)
>
> How did you test it? The utility afaik analyzes a file's encodings not 
> string encodings.
>

Starting with the byte string in the error message:

>>> f = open("junk.txt", "w")
>>> f.write(b'\xb6\xe3\xed\xf9\xf3\xf4\xef\xfc\xed\xef\xec\xe1 \xf3\xf5\xf3\xf4\xde\xec\xe1\xf4\xef\xf2\n')
>>> f.close()


> nikos at superhost.gr [~]# file www/cgi-bin/files.py
> www/cgi-bin/files.py: a /usr/bin/python script text executable
>
>
No point in doing that, as the string in question doesn't exist there.

-- 
DaveA





More information about the Python-list mailing list