"Martin v. Löwis" skrev:
> You need to do locale.setlocale(locale.LC_ALL, "") to get
> locale-specific upper-casing.
That makes a lot of sense. Thank you.
>>> 'før'.upper()
'F\xf8R'
>>> 'FØR'
'F\xd8R'
>>> import locale
>>> locale.setlocale(locale.LC_ALL, "")
'no_NO'
>>> 'før'.upper()
'F\xd8R'
>>
Leif B. Kristensen wrote:
Is there a way around this problem? My character set in Linux is
ISO-8859-1. In Windows 2000 it should be the equivavent Latin-1, though
I'm not sure about which character set the command shell is using.
You need to do locale.setlocale(locale.LC_ALL, "") to get
locale-spec
Leif B. Kristensen wrote:
Is there a way around this problem? My character set in Linux is
ISO-8859-1. In Windows 2000 it should be the equivavent Latin-1, though
I'm not sure about which character set the command shell is using.
The unicode methods seems to do it correctly. So you can decode your
Leif B. Kristensen skrev:
>Is there something else I have to do?
Please forgive me for talking with myself here :-) I should have looked
up Unicode in "Learning Python" before I asked. This seems to work:
>>> u'før'.upper()
u'F\xd8R'
>>> u'FØR'
u'F\xd8R'
>>> 'FØR'
'F\xd8R'
So far, so good. Note
> [EMAIL PROTECTED] wrote:
>
>> put
>>
>> import sys
>> sys.setdefaultencoding('UTF-8')
>>
>> into sitecustomize.py in the top level of your PYTHONPATH .
I found out of it, sort of. Now I've got a PYTHONPATH that points to my
home directory, and followed your instructions. The first time I got
[EMAIL PROTECTED] wrote:
> put
>
> import sys
> sys.setdefaultencoding('UTF-8')
>
> into sitecustomize.py in the top level of your PYTHONPATH .
Uh ... it doesn't seem like I've got PYTHONPATH defined on my system in
the first place:
[EMAIL PROTECTED] leif $ env |grep -i python
PYTHONDOCS=/usr/
> Is there a way around this problem?
put
import sys
sys.setdefaultencoding('UTF-8')
into sitecustomize.py in the top level of your PYTHONPATH .
--
http://mail.python.org/mailman/listinfo/python-list
I'm developing a routine that will parse user input. For simplicity, I'm
converting the entire input string to upper case. One of the words that
will have special meaning for the parser is the word "før", (before in
English). However, this word is not recognized. A test in the
interactive shell rev