Commits

Gustavo Picon committed f3cee4d

Reverting cb9261b32601 that was breaking dispatching in Python 3.

By trying to solve a double encoding issue, wsgi vars were not being
written in python 3.

Issue #1248 must be reopened.

Comments (0)

Files changed (1)

cherrypy/_cptree.py

                 # Python 3/WSGI u.0: all strings MUST be full unicode
                 environ['SCRIPT_NAME'] = sn
                 environ['PATH_INFO'] = path[len(sn.rstrip("/")):]
-            # for the wsgi 1.0 the environment is already encoded by the Gateway.
+            else:
+                # Python 3/WSGI 1.x: all strings MUST be ISO-8859-1 str
+                environ['SCRIPT_NAME'] = sn.encode('utf-8').decode('ISO-8859-1')
+                environ['PATH_INFO'] = path[len(sn.rstrip("/")):].encode('utf-8').decode('ISO-8859-1')
         return app(environ, start_response)