I see some frameworks like Django using unicode all over the place so it seems like it might be a good idea.
On the other hand, it seems like a big pain to have all these extra 'u's floating around everywhere.
What will be a problem if I don't do this?
Are there any issues that will come up if I do do this?
I'm using Pylons right now as my framework.
Python's string type uses the Unicode Standard for representing characters, which lets Python programs work with all these different possible characters.
1. Python 2 uses str type to store bytes and unicode type to store unicode code points. All strings by default are str type — which is bytes~ And Default encoding is ASCII.
In Python 2, a string is by default a binary string and you need to use u'' to mark a string as a Unicode string. However, in Python 3, a string by default is a Unicode string, and you need to use b'' to explicitly mark a string as a binary string.
Python supports the string type and the unicode type. A string is a sequence of chars while a unicode is a sequence of "pointers".
You can avoid the u''
in python 2.6 by doing:
from __future__ import unicode_literals
That will make 'string literals'
to be unicode objects, just like it is in python 3;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With