comparing Unicode and string

Neil Cerutti horpner at yahoo.com
Fri Nov 10 15:02:04 EST 2006


On 2006-11-10, Steve Holden <steve at holdenweb.com> wrote:
>>> But I don't insist on my PEP. The example just shows just
>>> another pitfall with Unicode and why I'll advise to any
>>> beginner: Never write text constants that contain non-ascii
>>> chars as simple strings, always make them Unicode strings by
>>> prepending the "u".
>> 
>> That doesn't do any good if you aren't writing them in unicode
>> code points, though.
>
> You tell the interpreter what encoding your source code is in.
> It then knows precisely how to decode your string literals into
> Unicode. How do you write things in "Unicode code points"?

for = u"f\xfcr"

-- 
Neil Cerutti



More information about the Python-list mailing list