How do I print unicode characters in Python 3 CGI?

Viewed 643

I am trying to run a python CGI script that has some Unicode strings. It works fine in console but when I run it in the browser it gives following error-

UnicodeEncodeError: 'ascii' codec can't encode character '\u2026' in position 198: ordinal not in range(128)

I have tried these two -
encode('ascii','ignore') unicodedata.normalize('NFKD',var).encode('ascii', 'ignore').strip()
var is the variable that holds the unicode string.

Now how do I print Unicode or ascii without error in the browser ?

1 Answers
Related