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

Ferrous Cranus nikos at superhost.gr
Fri Jul 5 02:07:19 EDT 2013


Στις 5/7/2013 3:06 πμ, ο/η Nobody έγραψε:
> On Thu, 04 Jul 2013 13:38:09 +0300, Νίκος wrote:
>
>> So you are also suggesting that what gesthostbyaddr() returns is not
>> utf-8 encoded too?
>
> The gethostbyaddr() OS function returns a byte string with no specified
> encoding. Python 3 will doubtless try to decode that to a character string
> using some (probably unspecified) encoding.

I see, but if the function returns a byte string not inutf-8 format then 
how my script is uspposes to decode this byte string?

And why only this error happens when i cloudflare my domain, while when 
i un-cloudflare it are reverse DNS are being resolves without problem.
So the queston is: How come it only fails when i cloidflare the domain?

Also please comment on that:

host =  gethostbyaddr(....) or "UnResolved"

This will return the first argument that define the evaluation as being 
true or untrue.

if function returns false the the 2nd argument.
Nut if the function gives an exception will the condition return the 2nd 
argument or will the program fail?

I was udner the impression that i could avoid error handling  inside 
try/excepts by utilizing "or".
-- 
What is now proved was at first only imagined!



More information about the Python-list mailing list