UTF-8 / German, Scandinavian letters - is it really this difficult?? Linux & Windows XP

Fuzzyman fuzzyman at gmail.com
Tue Feb 22 08:21:52 EST 2005


Mike Dee wrote:
> A very very basic UTF-8 question that's driving me nuts:
>
> If I have this in the beginning of my Python script in Linux:
>
> #!/usr/bin/env python
> # -*- coding: UTF-8 -*-
>
> should I - or should I not - be able to use non-ASCII characters
> in strings and in Tk GUI button labels and GUI window titles and in
> raw_input data without Python returning wrong case in manipulated
> strings and/or gibberished characters in Tk GUI title?
>
>
>
[snip..]

Yet another reply... :-)

My understanding is that the encoding declaration (as above) only
applies to the source code - and will not make your string literals
into unicode objects, nor set the default encoding for the interpreter.


This will mean string literals in your source code will be encoded as
UTF8 - if you handle them with normal string operations you might get
funny results.


Regards,

Fuzzy
http://www.voidspace.org.uk/python/index.shtml




More information about the Python-list mailing list