python3 default encoding UnicodeDecodeError ascii using apache WSGI python3 default encoding UnicodeDecodeError ascii using apache WSGI apache apache

python3 default encoding UnicodeDecodeError ascii using apache WSGI


finally found the answer when reading the file changed from

open('/path/to/feedback.html').read()

to

import codecswith codecs.open(file_path,'r',encoding='utf8') as f:     text = f.read()

if anyone has a more general approach that will work, I'll accept his answer


A Python 2+3 solution would be:

import iowith io.open(file_path, mode='r', encoding='utf8') as f:     text = f.read()

See the documentation of io.open.