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

Changeset 1306

Show
Ignore:
Timestamp:
09/01/06 11:46:53
Author:
fumanchu
Message:

No need to encode a string twice. :/

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/lib/http.py

    r1296 r1306  
    347347            for v in value: 
    348348                if isinstance(v, unicode): 
    349                     # Encode RFC-2047 TEXT (e.g. u"\u8200" -> "=?utf-8?b?6IiA?="). 
     349                    # HTTP/1.0 says, "Words of *TEXT may contain octets 
     350                    # from character sets other than US-ASCII." and 
     351                    # "Recipients of header field TEXT containing octets 
     352                    # outside the US-ASCII character set may assume that 
     353                    # they represent ISO-8859-1 characters." 
    350354                    try: 
    351355                        v = v.encode("iso-8859-1") 
    352356                    except UnicodeEncodeError: 
    353                         # HTTP/1.0 says, "Words of *TEXT may contain octets 
    354                         # from character sets other than US-ASCII." and 
    355                         # "Recipients of header field TEXT containing octets 
    356                         # outside the US-ASCII character set may assume that 
    357                         # they represent ISO-8859-1 characters." 
    358357                        if protocol >= (1, 1): 
    359                             v = v.encode("utf-8") 
     358                            # Encode RFC-2047 TEXT 
     359                            # (e.g. u"\u8200" -> "=?utf-8?b?6IiA?="). 
    360360                            v = Header(v, 'utf-8').encode() 
    361361                        else: 

Hosted by WebFaction

Log in as guest/cpguest to create tickets