Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 935

Show
Ignore:
Timestamp:
01/24/06 07:23:27
Author:
rdelon
Message:

Hopefully fixed #420

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/test/test_decodingencoding_filter.py

    r876 r935  
    44import cherrypy 
    55europoundUnicode = u'\x80\xa3' 
     6sing = u"\u6bdb\u6cfd\u4e1c: Sing, Little Birdie?" 
     7sing8 = sing.encode('utf-8') 
     8sing16 = sing.encode('utf-16') 
    69 
    710class Root: 
     
    1215     
    1316    def mao_zedong(self): 
    14         return u"\u6bdb\u6cfd\u4e1c: Sing, Little Birdie?" 
     17        return sing 
    1518    mao_zedong.exposed = True 
    1619 
     
    3639        # Default encoding should be utf-8 
    3740        self.getPage('/mao_zedong') 
    38         self.assertBody("\xe6\xaf\x9b\xe6\xb3\xbd\xe4\xb8\x9c: " 
    39                         "Sing, Little Birdie?") 
     41        self.assertBody(sing8) 
    4042         
    4143        # Ask for utf-16. 
    42         sing16 = ('\xff\xfe\xdbk\xfdl\x1cN:\x00 \x00S\x00i\x00n\x00g\x00,\x00 ' 
    43                   '\x00L\x00i\x00t\x00t\x00l\x00e\x00 ' 
    44                   '\x00B\x00i\x00r\x00d\x00i\x00e\x00?\x00') 
    4544        self.getPage('/mao_zedong', [('Accept-Charset', 'utf-16')]) 
    4645        self.assertBody(sing16) 
     
    5453        # The "*" value should default to our default_encoding, utf-8 
    5554        self.getPage('/mao_zedong', [('Accept-Charset', '*;q=1, utf-7;q=.2')]) 
    56         self.assertBody("\xe6\xaf\x9b\xe6\xb3\xbd\xe4\xb8\x9c: " 
    57                         "Sing, Little Birdie?") 
     55        self.assertBody(sing8) 
    5856         
    5957        # Only allow iso-8859-1, which should fail and raise 406. 

Hosted by WebFaction

Log in as guest/cpguest to create tickets