Fwd: Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte

Νίκος Gr33k nikos at superhost.gr
Fri Jul 5 14:21:03 CEST 2013




-------- Αρχικό μήνυμα --------
Θέμα: 	Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in 
position 0: invalid start byte
Ημερομηνία: 	Fri, 05 Jul 2013 15:16:45 +0300
Από: 	Νίκος Gr33k <nikos at superhost.gr>
Προς: 	feedthetroll at gmx.de



Στις 5/7/2013 3:06 μμ, ο/η feedthetroll at gmx.de έγραψε:
> Am Freitag, 5. Juli 2013 13:27:25 UTC+2 schrieb Νίκος Gr33k:
>> Στις 5/7/2013 2:16 μμ, ο/η Lele Gaifax έγραψε:
>>> UnicodeDecodeError('utf-8', b'\xb6\xe3\xed\xf9\xf3
>>> first string-------^^^^^^^
>>> second string---------------^^^^^^^^^^^^^^^^^^^^^^
>>
>> Hold on please!
>>   From where do these dashes and carets characters come from?
>
> ROTFL!!!!
> Nikos, you made my day, again! Fun is back in these threads!

Oh my God! i though they were the actual sting not that the pointed to
the string themselves! I ebn laughted at me!
>> Also from where do you see 2 strings?
>
> Look, my little dumb baby: The dashes and carets point to the strings.
> The first one being 'utf-8', the second one starting with '\xb6\xe3\xed' (being a bytestring, therefore the b before the ')
> Sorry, I forgot. You are not using python for your business, therefore you can't know, that strings in python can for example be identified by surrounding '.


Indeed, but where is the 2nd sttring coming from?
>> ic an understandn onlt that utf-8 has failsed decoding some byte stream
>> satrting with \xb6
> So ... where did you call utf-8() so that it could try to decode something?

Thats still unknown,

At least i manages to solve this by:

try:
   host = socket.gethostbyaddr( os.environ['HTTP_CF_CONNECTING_IP'] )[0]
except Exception as e:
   host = repr(e)


Seems like when you cloudflare a domain you can  no longer have the
originates ip address of the visitor but you have to read the above
environmental variable to be bale to retrieve it!



-- 
What is now proved was at first only imagined!




-- 
What is now proved was at first only imagined!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130705/84535fac/attachment.html>


More information about the Python-list mailing list