There is a potential for requests using UTF-8 characters within the request path to cause a crash with WSGI.
# PEP 3333 specifies that the PATH_INFO variable is always
# "bytes tunneled as latin-1" and must be encoded back.
#
# NOTE(kgriffs): The decoded path may contain UTF-8 characters.
# But according to the WSGI spec, no strings can contain chars
# outside ISO-8859-1. Therefore, to reconcile the URI
# encoding standard that allows UTF-8 with the WSGI spec
# that does not, WSGI servers tunnel the string via
# ISO-8859-1, e.g.:
#
# tunnelled_path = path.encode('utf-8').decode('iso-8859-1')
# perf(vytas): Only decode the tunnelled path in case it is not ASCII.
# For ASCII-strings, the below decoding chain is a no-op.
# If not isascii(path):
path = path.encode('iso-8859-1').decode('utf-8', 'replace')
There is a potential for requests using UTF-8 characters within the request path to cause a crash with WSGI.
Is the relevant PEP, thanks @pfeairheller