Feb-16-2019, 08:31 PM
Raw output of names is:
Here is the code concerning names:
ps. I can give you access to my server if you want to see/try something for yourself.
Output:['Alexander Lepsveridze', 'John Comeau', '\xce\x86\xce\xba\xce\xb7\xcf\x82 \xce\xa4\xcf\x83\xce\xb9\xce\xac\xce\xbc\xce\xb7\xcf\x82', '\xce\x8c\xce\xbc\xce\xb9\xce\xbb\xce\xbf\xcf\x82 \xce\xa4\xcf\x83\xce\xbf\xcf\x84\xcf\x85\xce\xbb\xce\xaf\xce\xbf\xcf\x85']
Still i cannot understand WHY it reads the database names like that, instead of their normal Greek names.Here is the code concerning names:
Output: names = []
cur.execute( '''SELECT name, phone, hits, money FROM clients ORDER BY hits DESC''' )
data = cur.fetchall()
#print each and every client record
for row in data:
(name, phone, hits, money) = row
#populate client listing into list
names.append( name )
......
......
# populate names, months, years
names.append( '' )
names.sort()
names = [s.encode('latin1').decode('utf8') for s in names]
And here is when it fail to do the encoding providing the error of:Output:UnicodeEncodeError('latin-1', 'Άκης Τσιάμης', 0, 4, 'ordinal not in range(256)')
I use Apache + Bottle + PyMySQL. Before chnaging to Bottle from Flask in the exact same database this error does not appear.ps. I can give you access to my server if you want to see/try something for yourself.