Flask: rendering unicode characters in template Flask: rendering unicode characters in template flask flask

Flask: rendering unicode characters in template


add below to your start up file

import sysif sys.version_info.major < 3:    reload(sys)sys.setdefaultencoding('utf8')

this works for me


Your message is non-ascii, you have to decode it and convert it to unicode.

your can convert it using.

{{ message.decode('utf-8') }}


My unicode strings were embedded in arrays and objects, and I passed them using json.dumps() to get rid of the unicode references.

https://stackoverflow.com/a/50612950/999943