Cyrillic characters in Python 2.7 -
the function returns places in radius using google places api. exact, use this library handle task.
the problem cyrillic symbols shown this:
ÐО Сбербанк РоÑÑии, КиевÑкое отделение â„–14
i tried these suggestions. tried this:
pname = place.name uni = unicode(place.name)
and this:
convertedname = pname.encode(encoding='utf-8', errors='strict')
nothing helped. else can try?
list(bytearray("надра"))
[208, 189, 208, 176, 208, 180, 209, 128, 208, 176]
that's utf-8. if output terminal set utf-8, should need no encoding or decoding @ all. proper way read string use string.decode('utf-8')
turn proper unicode string, encode before output whatever encoding terminal supports (looks vaguely ... code page 1250 or iso-8859-2?).
https://rawgit.com/tripleee/8bit/master/encodings.html#0xd0 shows 208 (0xd0) being mapped Đ in 6 different encodings, conjecture using 1 of those. rest speculation on part.
so, basically,
pname=place.name.decode('utf-8')
apparently, need encode suitable output encoding console, or set console support utf-8. if indeed terminal presently set cp1250, not support cyrillic output @ all.
Comments
Post a Comment