Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.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.016 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'utf-8': 0.07; "'a'": 0.09; '127': 0.16; 'andreas': 0.16; 'bye,': 0.16; 'codec': 0.16; 'expects': 0.16; 'ordinal': 0.16; 'unexpected': 0.16; 'wrote:': 0.18; 'value.': 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'byte': 0.24; 'bytes': 0.24; 'header:In-Reply-To:1': 0.27; 'url:wiki': 0.31; 'url:wikipedia': 0.31; 'table': 0.34; 'subject:from': 0.34; 'subject: (': 0.35; "can't": 0.35; 'skip:s 30': 0.35; 'received:google.com': 0.35; 'url:org': 0.36; 'received:10': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'skip:u 10': 0.60; 'reads': 0.68; '8bit%:100': 0.72 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=jg3BSunxbXxkg/wS7wfJa2Q2UI6Z1gtbi5AkNHDLVeo=; b=e7Ejcn//jF2XUhQ7sPExZXEeU7/v9cCxujjErajyGiZv9TUAtAVNgail4QVozFcPZv LLYyJL9ikGlV0PvldLfKsfoHoKP2eaWQkWFhos5fnYUfhyX8Bh+RYX3mIvGt5coFn42O Em907KH6GxztinuZcozcVBdNwIdEsfT2YORoKfFQYEYzP97dQa5Ar9TTiRUPn/GrXcCS Miy6nyahdZzavHe6IGp1OmID3hZ1wAl5I33azoIq8eI1XeeCKKj0384j+de8QrFt8HLa 1WM/CoUTUukZl8EKrr5Qono0XGVLUN2gByu0Bv3pHUFlRCNV1PhB3kx3XNVUFjgjQfcl mdXA== X-Received: by 10.194.103.73 with SMTP id fu9mr3244302wjb.70.1370780646959; Sun, 09 Jun 2013 05:24:06 -0700 (PDT) Date: Sun, 09 Jun 2013 14:24:03 +0200 From: Andreas Perstinger User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Changing filenames from Greeklish => Greek (subprocess complain) References: <7d8da6c9-fb92-4329-b207-4280f29ba664@googlegroups.com> <20130608024931.GA77888@cskk.homeip.net> <51B37173.9060601@gmail.com> <3fbb5d0e-51fb-4aed-b829-8388304a9885@googlegroups.com> <51b4249d$0$30001$c3e8da3$5496439d@news.astraweb.com> <9a0ea98b-f37b-48da-9933-e2caf6fdfdff@googlegroups.com> <7e01dc4a-ffc0-43ce-8d6b-8bc069a63f19@googlegroups.com> In-Reply-To: <7e01dc4a-ffc0-43ce-8d6b-8bc069a63f19@googlegroups.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1370780648 news.xs4all.nl 15965 [2001:888:2000:d::a6]:50077 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:47455 On 09.06.2013 11:38, Νικόλαος Κούρας wrote: > s = 'α' > s = s.encode('iso-8859-7').decode('utf-8') > print( s ) > > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 0: unexpected end of data > > Why this error? because 'a' ordinal value > 127 ? >>> s = 'α' >>> s.encode('iso-8859-7') b'\xe1' >>> bin(0xe1) '0b11100001' Now look at the table on https://en.wikipedia.org/wiki/UTF-8#Description to find out how many bytes a UTF-8 decoder expects when it reads that value. Bye, Andreas