inserting Unicode character in dictionary
Joe Strout
joe at strout.net
Fri Oct 17 13:32:36 EDT 2008
More information about the Python-list mailing list
Fri Oct 17 13:32:36 EDT 2008
- Previous message (by thread): inserting Unicode character in dictionary - Python
- Next message (by thread): inserting Unicode character in dictionary - Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Oct 17, 2008, at 11:24 AM, Marc 'BlackJack' Rintsch wrote: >> kw = 'генских' >> > What do you mean by "does not work"? And you are aware that the above > snipped doesn't involve any unicode characters!? You have a byte > string > there -- type `str` not `unicode`. Just checking my understanding here -- are the following all true: 1. If you had prefixed that literal with a "u", then you'd have Unicode. 2. Exactly what Unicode you get would be dependent on Python properly interpreting the bytes in the source file -- which you can make it do by adding something like "-*- coding: utf-8 -*-" in a comment at the top of the file. 3. Without the "u" prefix, you'll have some 8-bit string, whose interpretation is... er... here's where I get a bit fuzzy. What if your source file is set to utf-8? Do you then have a proper UTF-8 string, but the problem is that none of the standard Python library methods know how to properly interpret UTF-8? 4. In Python 3.0, this silliness goes away, because all strings are Unicode by default. Thanks for any answers/corrections, - Joe
- Previous message (by thread): inserting Unicode character in dictionary - Python
- Next message (by thread): inserting Unicode character in dictionary - Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list