Commits

Robert Brewer committed dca36d1

No need to encode a string twice. :/

Comments (0)

Files changed (1)

cherrypy/lib/http.py

                 value = [value]
             for v in value:
                 if isinstance(v, unicode):
-                    # Encode RFC-2047 TEXT (e.g. u"\u8200" -> "=?utf-8?b?6IiA?=").
+                    # HTTP/1.0 says, "Words of *TEXT may contain octets
+                    # from character sets other than US-ASCII." and
+                    # "Recipients of header field TEXT containing octets
+                    # outside the US-ASCII character set may assume that
+                    # they represent ISO-8859-1 characters."
                     try:
                         v = v.encode("iso-8859-1")
                     except UnicodeEncodeError:
-                        # HTTP/1.0 says, "Words of *TEXT may contain octets
-                        # from character sets other than US-ASCII." and
-                        # "Recipients of header field TEXT containing octets
-                        # outside the US-ASCII character set may assume that
-                        # they represent ISO-8859-1 characters."
                         if protocol >= (1, 1):
-                            v = v.encode("utf-8")
+                            # Encode RFC-2047 TEXT
+                            # (e.g. u"\u8200" -> "=?utf-8?b?6IiA?=").
                             v = Header(v, 'utf-8').encode()
                         else:
                             raise
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.