Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'charset:iso-8859-7': 0.04; 'encoding': 0.05; 'encoded': 0.07; 'skip:\\ 20': 0.07; 'ascii': 0.09; 'bytes.': 0.09; 'filename': 0.09; 'filenames': 0.09; 'happens.': 0.09; 'skip:\\ 10': 0.09; 'python': 0.11; 'charset': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'wrote:': 0.18; 'things.': 0.19; 'command': 0.22; '>>>': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'byte': 0.24; 'unicode': 0.24; 'looks': 0.24; 'question': 0.24; 'source': 0.25; 'posts': 0.26; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'michael': 0.29; "we'd": 0.29; 'character': 0.29; "doesn't": 0.30; 'returned': 0.30; 'code': 0.31; "skip:' 10": 0.31; 'file': 0.32; 'text': 0.33; 'guess': 0.33; 'actual': 0.34; 'subject:from': 0.34; 'could': 0.34; 'problem': 0.35; 'subject: (': 0.35; "can't": 0.35; 'received:84': 0.35; 'but': 0.35; 'there': 0.35; 'sequence': 0.36; '\xf4\xef\xf5': 0.36; 'possible': 0.36; 'should': 0.36; 'example,': 0.37; 'starting': 0.37; 'same.': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'previous': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'even': 0.60; 'read': 0.60; 'tell': 0.60; 'hope': 0.61; "you're": 0.61; 'first': 0.61; 'header:Reply-To:1': 0.67; 'anything.': 0.68; 'reply-to:no real name:2**0': 0.71; 'greek': 0.84; 'guessed': 0.84; 'reply- to:addr:python.org': 0.84; 'was:': 0.91 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=cIzZ7DuN c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=oyR3mlnJdzkA:10 a=AdgiQdVXbpoA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=E_FQspuQcigA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=uw23S90zXSUA:10 a=b23tgpmCMmjLIOmpMOIA:9 a=o3X3QV6JOaEA:10 X-AUTH: mrabarnett:2500 Date: Wed, 05 Jun 2013 17:44:14 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Changing filenames from Greeklish => Greek (subprocess complain) References: <2c425f2b-99de-4453-964e-c585f2043f71@googlegroups.com> <306a22ea-fbf7-4097-af31-121a999957d6@googlegroups.com> <9c482ba0-23ac-4e66-a0e1-a18be9fd82d8@googlegroup> <06a19483-65df-4fcd-9430-b45a01c9dbab@googlegroups.com> <0c215f6d-c1eb-4dbf-b132-80e83ece0992@googlegroups.com> <4c271468-22f4-4c93-af14-02b978b2e6bd@googlegroups.com> <0a05fe41-12a9-47e5-a4e9-170140eb3eea@googlegroups.com> <96d574cf-653a-4d49-a5c9-475dfe082ccb@googlegroups.com> <4fa2ed0b-f6e8-4cfd-bb81-92c30deba91e@googlegroups.com> <51AECF57.8020801@gmail.com> In-Reply-To: <51AECF57.8020801@gmail.com> Content-Type: text/plain; charset=ISO-8859-7; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1370450657 news.xs4all.nl 15949 [2001:888:2000:d::a6]:52940 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:47111 On 05/06/2013 06:40, Michael Torrie wrote: > On 06/04/2013 10:15 PM, Νικόλαος Κούρας wrote: >> One of my Greek filenames is "Ευχή του Ιησού.mp3". Just a Greek >> filename with spaces. Is there a problem when a filename contain both >> english and greek letters? Isn't it still a unicode string? >> >> All i did in my CentOS was 'mv "Euxi tou Ihsou.mp3" "Ευχή του >> Ιησού.mp3" >> >> and the displayed filename after 'ls -l' returned was: >> >> is -rw-r--r-- 1 nikos nikos 3511233 Jun 4 14:11 \305\365\367\336\ >> \364\357\365\ \311\347\363\357\375.mp3 >> >> There is no way at all to check the charset used to store it in hdd? >> It should be UTF-8, but it doesn't look like it. Is there some linxu >> command or some python command that will print out the actual >> encoding of '\305\365\367\336\ \364\357\365\ >> \311\347\363\357\375.mp3' ? > > I can see that you are starting to understand things. I can't answer > your question (don't know the answer), but you're correct about one > thing. A filename is just a sequence of bytes. We'd hope it would be > utf-8, but it could be anything. Even worse, it's not possible to tell > from a byte stream what encoding it is unless we just try one and see > what happens. Text editors, for example, have to either make a guess > (utf-8 is a good one these days), or ask, or try to read from the first > line of the file using ascii and see if there's a source code character > set command to give it an idea. > From the previous posts I guessed that the filename might be encoded using ISO-8859-7: >>> s = b"\305\365\367\336\ \364\357\365\ \311\347\363\357\375.mp3" >>> s.decode("iso-8859-7") 'Ευχή\\ του\\ Ιησού.mp3' Yes, that looks the same.