diff options
| author | Tim Graham <timograham@gmail.com> | 2013-08-19 08:29:32 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-08-19 09:09:41 -0400 |
| commit | 7b69c3e7758770dd632e1754c30714e91868e037 (patch) | |
| tree | 6db95562b498db0651c6e951c92062543f414b7c /docs/ref/unicode.txt | |
| parent | 58c6d0209d71872f0682d478921db1e00496e16c (diff) | |
Removed versionadded/changed annotations for 1.5
Diffstat (limited to 'docs/ref/unicode.txt')
| -rw-r--r-- | docs/ref/unicode.txt | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/docs/ref/unicode.txt b/docs/ref/unicode.txt index c9534c12c9..306a2dfb48 100644 --- a/docs/ref/unicode.txt +++ b/docs/ref/unicode.txt @@ -45,28 +45,26 @@ rendering or anywhere else -- you have two choices for encoding those strings. You can use Unicode strings, or you can use normal strings (sometimes called "bytestrings") that are encoded using UTF-8. -.. versionchanged:: 1.5 +In Python 3, the logic is reversed, that is normal strings are Unicode, and +when you want to specifically create a bytestring, you have to prefix the +string with a 'b'. As we are doing in Django code from version 1.5, +we recommend that you import ``unicode_literals`` from the __future__ library +in your code. Then, when you specifically want to create a bytestring literal, +prefix the string with 'b'. - In Python 3, the logic is reversed, that is normal strings are Unicode, and - when you want to specifically create a bytestring, you have to prefix the - string with a 'b'. As we are doing in Django code from version 1.5, - we recommend that you import ``unicode_literals`` from the __future__ library - in your code. Then, when you specifically want to create a bytestring literal, - prefix the string with 'b'. +Python 2 legacy:: - Python 2 legacy:: + my_string = "This is a bytestring" + my_unicode = u"This is an Unicode string" - my_string = "This is a bytestring" - my_unicode = u"This is an Unicode string" +Python 2 with unicode literals or Python 3:: - Python 2 with unicode literals or Python 3:: - - from __future__ import unicode_literals + from __future__ import unicode_literals - my_string = b"This is a bytestring" - my_unicode = "This is an Unicode string" + my_string = b"This is a bytestring" + my_unicode = "This is an Unicode string" - See also :doc:`Python 3 compatibility </topics/python3>`. +See also :doc:`Python 3 compatibility </topics/python3>`. .. warning:: |
