Convert unicode cyrillic symbols to string in python -
this question has answer here:
when try convert unicode:
a = u"Тест" to string:
str(a) i got error:
'ascii' codec can't encode characters in position 0-3: ordinal not in range(128) i need str(a) give me output:
>> str(a) >> 'Тест'
pick encoding can encode cyrillic symbols, such utf-8:
>>> = u'Тест' >>> a.encode('utf-8') '\xd0\xa2\xd0\xb5\xd1\x81\xd1\x82' the ascii table doesn't have code points cyrillic characters, need specify encoding explicitly.
but if want print string, should care encoding of terminal , system font.