Problem with sets and Unicode strings

Dennis Benzinger Dennis.Benzinger at gmx.net
Thu Jun 29 15:19:30 EDT 2006


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>


Bye,
Dennis



More information about the Python-list mailing list