Ed Leafe wrote:
> On Feb 24, 2009, at 8:18 AM, Pedro Vale de Gato wrote:
>
>> Sorry for hijacking this thread, but UnicodeEncodeErrors are quite
>> common on dabo apps, i'm a portuguese speaker, so i've face them quite
>> often, i've fixed some of them, however, i think the final solution is
>> to put:
>>
>> import sys
>> if hasattr(sys, "frozen"): #py2exe
>> sys.setdefaultencoding('utf-8')
>> else: #The Python interpreter needs to reload
>> the
>> function
>> reload(sys)
>> sys.setdefaultencoding('utf-8')
>> del sys.setdefaultencoding
>>
>> in the app main file start.
>>
>> This will set pythons default encoding to utf8, which will allow a
>> much
>> broader set of characters to be used.
>
> I've considered this, but there are a lot of systems out there that
> are not using utf-8, and this would cause even more problems. Perhaps
> tying this to dabo.defaultEncoding might give us enough flexibility
> for those using different encodings.
>
> Can anyone out there who is using something other than utf-8 verify
> that this will also work in their systems?
Let's do this:
reload(sys)
sys.setdefaultencoding(dabo.defaultEncoding)
del sys.setdefaultencoding
And then tell people that experience trouble to simply:
dabo.defaultEncoding = "whatever"
immediately after importing dabo.
Paul
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[email protected]