Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!feeder3.eweka.nl!81.171.88.15.MISMATCH!eweka.nl!lightspeed.eweka.nl!194.134.4.91.MISMATCH!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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; 'encoding': 0.05; 'that?': 0.05; 'encoded': 0.07; "subject:' ": 0.07; 'utf-8': 0.07; 'subject:position': 0.09; '(it': 0.16; '12:50': 0.16; 'codec': 0.16; 'eckhardt': 0.16; 'expecting': 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; 'sequence.': 0.16; 'subject: \n ': 0.16; 'subject:start': 0.16; 'too?': 0.16; 'undo': 0.16; 'alpha': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'import': 0.22; 'previously': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'byte': 0.24; 'specify': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'character': 0.29; 'up.': 0.33; 'could': 0.34; "can't": 0.35; 'common': 0.35; 'received:84': 0.35; 'but': 0.35; "didn't": 0.36; 'should': 0.36; 'changing': 0.37; 'error.': 0.37; 'clear': 0.37; 'starting': 0.37; 'to:addr:python- list': 0.38; 'subject:can': 0.39; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'referred': 0.60; "you're": 0.61; "you'll": 0.62; "you've": 0.63; 'header:Reply-To:1': 0.67; 'invalid': 0.68; 'reply-to:no real name:2**0': 0.71; '8bit%:92': 0.71; 'capital': 0.73; 'jul': 0.74; 'premature': 0.84; 'reply-to:addr:python.org': 0.84; 'from.': 0.93 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=RZapVTdv c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=K2DDQYBT4xIA:10 a=scYcj5qmBLgA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=PMVg_betNJUA:10 a=91HMoPvB4-3s9DAXKfAA:9 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett:2500 Date: Thu, 04 Jul 2013 12:06:40 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: python-list@python.org Subject: Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte References: In-Reply-To: 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 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: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1372935984 news.xs4all.nl 15983 [2001:888:2000:d::a6]:38307 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49841 On 04/07/2013 11:38, Νίκος wrote: > Στις 4/7/2013 12:50 μμ, ο/η Ulrich Eckhardt έγραψε: >> Am 04.07.2013 10:37, schrieb Νίκος: >>> I just started to have this error without changing nothing >> >> Well, undo the nothing that you didn't change. ;) >> >>> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: >>> invalid start byte >>> [Thu Jul 04 11:35:14 2013] [error] [client 108.162.229.97] Premature end >>> of script headers: metrites.py >>> >>> Why cant it decode the starting byte? what starting byte is that? >> >> It's the 0xb6 but it's expecting the starting byte of a UTF-8 sequence. >> Please do some research on UTF-8, that should clear it up. You could >> also search for common causes of that error. > > So you are also suggesting that what gesthostbyaddr() returns is not > utf-8 encoded too? > > What character is 0xb6 anyways? > Well, it's from a bytestring, so you'll have to specify what encoding you're using! (It clearly isn't UTF-8.) If it's ISO-8859-7 (what you've previously referred to as "greek-iso"), then: >>> import unicodedata >>> unicodedata.name(b"\xb6".decode("ISO-8859-7")) 'GREEK CAPITAL LETTER ALPHA WITH TONOS' You'll need to find out where that bytestring is coming from.