Problem with sets and Unicode strings
Robert Kern
robert.kern at gmail.com
Thu Jun 29 15:46:57 EDT 2006
Dennis Benzinger wrote:
> Robert Kern wrote:
>> Dennis Benzinger wrote:
>>> Ok, I understand.
>>> But isn't it a (minor) problem that using a set like this:
>>>
>>> # -*- coding: UTF-8 -*-
>>>
>>> FIELDS_SET = set(("Fächer", ))
>>>
>>> print u"Fächer" in FIELDS_SET
>>> print u"Fächer" == "Fächer"
>>>
>>> shadows the error of not setting sys.defaultencoding()?
>> You can't set the default encoding. If you could, then scripts that run
>> on your machine wouldn't run on mine.
>> [...]
>
> As Serge Orlov wrote in one of his posts you _can_ set the default
> encoding (at least in site.py). See
> <http://docs.python.org/lib/module-sys.html>
Okay, *don't* set the default encoding to anything other than 'ascii'. Doing so
would be an error, not the other way around.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list