Code

Changes between Version 8 and Version 9 of StringEncoding


Ignore:
Timestamp:
02/22/11 03:58:38 (3 years ago)
Author:
lukeplant
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • StringEncoding

    v8 v9  
    4747For simplicity and the sanity of developers (both core and third-party), Django adopts a fairly simple policy when it comes to interpreting form input. Form submissions are assumed to be in the DEFAULT_CHARSET setting. However, decoding of the input is only done when the GET and POST attributes on an !HttpRequest object are accessed and the decoding is not cached in any way. So the "encoding" attribute on the !HttpRequest instance can be changed and this will update the encoding that is assumed when interpreting GET and POST data. File uploads are never decoded in any way, since they are assumed to already be an arbitrary and opaque sequence of bytes. 
    4848 
    49 ''Notes: 
     49''Notes:'' 
    5050 * This is one area where conversion from UTF-8 to unicode may fail, due to malicious or accidental causes. Any invalid input is treated Python's "replace" codecs error handling. 
    5151 * setting "accept" types on forms makes it the responsibility of the developer to handle. Don't guess. 
    52 '' 
     52 
    5353 
    5454== Passing Strings Between Django and the Developer's Code ==