Changing filenames from Greeklish => Greek (subprocess complain)

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Jun 3 18:37:37 EDT 2013


(Note: this post is sent using UTF-8. If anyone reading this sees 
mojibake, please make sure your email or news client is set to use UTF-8.)



On Mon, 03 Jun 2013 05:54:30 -0700, rusi wrote:

> On Jun 3, 2:12 pm, Νικόλαος Κούρας <nikos.gr... at gmail.com> wrote:
>> You are right Steven, i just renames the file 'Euxi tou Ihsou.mp3' =>
>> 'Eõ÷Þ ôïõ Éçóïý.mp3' and…
> 
> Is that how you renamed your file?
> In any case thats what I see!!

rusi, whatever program you are using to read these posts is buggy.

Nicholas (please excuse me ASCII-fying his name, but given that we are 
discussing encoding problems, it is probably for the best) sent his post 
with a header line:

charset=ISO-8859-7

If your client honoured that charset line, you would see:

Eυχή του Ιησού.mp3

It looks like your client is ignoring the charset header, and 
interpreting the bytes as Latin-1 when they are actually ISO-8859-7.

py> s = 'Eυχή του Ιησού.mp3'
py> print(s.encode('ISO-8859-7').decode('latin-1'))
Eõ÷Þ ôïõ Éçóïý.mp3

which matches what you see. If you can manually tell your client to use 
ISO-8859-7, you should see it correctly.



-- 
Steven



More information about the Python-list mailing list