diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-05-25 09:48:02 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-05-25 09:48:02 +0000 |
| commit | 7ba850af3ba4ac7dbe3d67a2360079bce0bf0eb3 (patch) | |
| tree | 9060bd793b288b686e0894d8dd33061027991da9 /docs | |
| parent | 29d2094b29ccbc09f49772ca7dd773aca5114a9b (diff) | |
unicode: Added a more convenient way to set/change the encoding on a request
instance.
git-svn-id: http://code.djangoproject.com/svn/django/branches/unicode@5342 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -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 |
