Next question is how did you _insert_ those names into the database previously? 
Are the names showing up ok using any other tool to look at them?

The error might have been on insert and you're just seeing weird stuff now 
because of that. Maybe, where instead of giving it the text and letting the 
module deal with encodings, you gave it the raw UTF-8 encoding, and the module 
or db server said "let me encode that into the field or database defined 
default of latin-1 for you"... or something like that.


-----Original Message-----
From: Python-list 
[mailto:python-list-bounces+david.raymond=tomtom....@python.org] On Behalf Of 
vergos.niko...@gmail.com
Sent: Thursday, February 14, 2019 2:56 PM
To: python-list@python.org
Subject: Re: Convert a list with wrong encoding to utf8

Τη Πέμπτη, 14 Φεβρουαρίου 2019 - 8:56:31 μ.μ. UTC+2, ο χρήστης MRAB έγραψε:

> It doesn't have a 'b' prefix, so either it's Python 2 or it's a Unicode 
> string that was decoded wrongly from the bytes.

Yes it doesnt have the 'b' prefix so that hexadecimal are representation of 
strings and not representation of bytes.

I just tried:

names = tuple( [s.encode('latin1').decode('utf8') for s in names] )

but i get
UnicodeEncodeError('latin-1', 'Άκης Τσιάμης', 0, 4, 'ordinal not in range(256)')

'Άκης Τσιάμης' is a valid name but even so it gives an error.

Is it possible that Python3 a Unicode had the string wrongly decoded from the 
bytes ?

What can i do to get the names?!
-- 
https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to