Anonymous committed 696a285

Hopefully fixed #420

Comments (0)

Files changed (1)


 import cherrypy
 europoundUnicode = u'\x80\xa3'
+sing = u"\u6bdb\u6cfd\u4e1c: Sing, Little Birdie?"
+sing8 = sing.encode('utf-8')
+sing16 = sing.encode('utf-16')
 class Root:
     def index(self, param): = True
     def mao_zedong(self):
-        return u"\u6bdb\u6cfd\u4e1c: Sing, Little Birdie?"
+        return sing = True
 cherrypy.root = Root()
         # Default encoding should be utf-8
-        self.assertBody("\xe6\xaf\x9b\xe6\xb3\xbd\xe4\xb8\x9c: "
-                        "Sing, Little Birdie?")
+        self.assertBody(sing8)
         # Ask for utf-16.
-        sing16 = ('\xff\xfe\xdbk\xfdl\x1cN:\x00 \x00S\x00i\x00n\x00g\x00,\x00 '
-                  '\x00L\x00i\x00t\x00t\x00l\x00e\x00 '
-                  '\x00B\x00i\x00r\x00d\x00i\x00e\x00?\x00')
         self.getPage('/mao_zedong', [('Accept-Charset', 'utf-16')])
         # The "*" value should default to our default_encoding, utf-8
         self.getPage('/mao_zedong', [('Accept-Charset', '*;q=1, utf-7;q=.2')])
-        self.assertBody("\xe6\xaf\x9b\xe6\xb3\xbd\xe4\xb8\x9c: "
-                        "Sing, Little Birdie?")
+        self.assertBody(sing8)
         # Only allow iso-8859-1, which should fail and raise 406.
         self.getPage('/mao_zedong', [('Accept-Charset', 'iso-8859-1, *;q=0')])
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
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.