diff options
Diffstat (limited to 'docs/unicode.txt')
-rw-r--r-- | docs/unicode.txt | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/docs/unicode.txt b/docs/unicode.txt index 41df214387..01fff198c1 100644 --- a/docs/unicode.txt +++ b/docs/unicode.txt @@ -337,14 +337,17 @@ be returned exactly as they were submitted by the client. By default, the ``DEFAULT_CHARSET`` setting is used as the assumed encoding for form data. If you need to change this for a particular form, you can set the ``encoding`` attribute on the ``GET`` and ``POST`` data structures. For -example:: +convenience, changing the ``encoding`` property on an ``HttpRequest`` instance +does this for you. For example:: def some_view(request): # We know that the data must be encoded as KOI8-R (for some reason). - request.GET.encoding = 'koi8-r' - request.POST.encoding = 'koi8-r' + request.encoding = 'koi8-r' ... +You can even change the encoding after having accessed ``request.GET`` or +``request.POST`` and all subsequent accesses will use the new encoding. + It will typically be very rare that you would need to worry about changing the form encoding. However, if you are talking to a legacy system or a system beyond your control with particular ideas about encoding, you do have a way to |