[Product-Developers] Re: Re: UnicodeDecodeError

Derek Broughton news at pointerstop.ca
Mon Mar 24 20:19:48 UTC 2008


Andreas Jung wrote:

> 
> 
> --On 24. März 2008 16:27:22 -0300 Derek Broughton
> <news at pointerstop.ca> wrote:
> 
>> Dirceu Pereira Tiegs wrote:
>>
>>> Em 24/03/2008, às 14:39, Walter Cruz escreveu:
>>>>> I was with the same problem some months ago. One possible workaround
>>>>> is to set the default encoding of your python environment to utf-8;
>>>>> worked for me.
>>>>>
>>>>> Regards,
>>>>
>>>> Hi Dirceu! Yes, I can do it. But isn't a little hackish?
>>>
>>>
>>> Yes, totally. :-)
>>>
>>> Like I said, it's a workaround, not a fix. I didn't had the time to
>>> look for a proper fix last time I used AGX (a couple of months ago).
>>
>> I'm not convinced it's "hackish" - one suspects that if you intend to use
>> non-ascii characters on your site, python _should_ be set up for unicode
>> - but I wish it was a little more obvious what is right (and more
>> importantly if there are any python issues we're going to run into by
>> changing the default - I would guess there's a reason why it ships
>> without a unicode default).
> 
> 
> What are you talking about? Python has nothing like a 'unicode' default.
> Likely you're referring to sys.getdefaultencoding() which is ascii by
> default. 

Why do you always have to be so confrontational?

That is, of course, what I'm talking about - and I know perfectly well that
it's NOT a unicode default.  If you read the posts, that would be clear.

> General rule #1: don't touch that. Rule #2: if you have the need 
> to touch the default encoding as a workaround: better fix your code first.

Funny, but it's not _my_ code that runs into problems - in fact it's some of
yours.  SQLAlchemyDA won't read non-ascii data off my UTF-8 postgres or
Oracle databases.  

I _have_ non-ascii strings in my data, I'm not going to change that.  It
seems to me that the only way to make Plone work with it is to set my
default encoding to unicode.  It's worked so far, and it _may_ be hackish, 
As I said, it seems logical that there's a reason why it's not Unicode by
default, but you're not helping any by just saying we should "fix our
code".

-- 
derek





More information about the Product-Developers mailing list