14 | | `u("foo")` or `b("bar")` respectively). '''Note:''' this is needed for Python 2.5 compatibility only. For compatibility only with Python 2.6 and later, add `from __future__ import unicode_literals` in all modules where you are using Unicode literals, and remove the `u` prefix from the Unicode literals, as you don't need it. If you need native strings, use `from django.utils.py3 import n` and replace those literals with `n(...)`. This will return `str` on both 2.x and 3.x. If you need byte strings, use `b'foo'`. |
| 14 | `u("foo")` or `b("bar")` respectively). '''Note:''' this is needed for Python 2.5 compatibility only. For compatibility only with Python 2.6 and later, add `from __future__ import unicode_literals` in all modules where you are using Unicode literals, and remove the `u` prefix from the Unicode literals, as you don't need it. If you need native strings, use `from django.utils.py3 import n` and replace those literals with `n(...)`. This will return `str` on both 2.x and 3.x. If you need byte strings, use `b'foo'`. Unfortunately, it's hard to know where native strings are required: for example, some 2.x C-based APIs expect native strings and behave unexpectedly when passed Unicode strings. |