← Back to team overview

openerp-community team mailing list archive

Re: [Question #196467]: Python Set Default Encoding ('utf-8')

 

Question #196467 on OpenERP Server changed:
https://answers.launchpad.net/openobject-server/+question/196467

    Status: Open => Answered

digitalsatori proposed the following answer:
don't rely on default encoding. Always specify encoding explicitly when
converting between unicode and byte string.
If there is any encoding or decoding error, it signal that you specify
encoding wrongly somewhere.

Regards,

Tony Gu


On Tue, May 8, 2012 at 5:10 PM, John Chen <
question196467@xxxxxxxxxxxxxxxxxxxxx> wrote:

> New question #196467 on OpenERP Server:
> https://answers.launchpad.net/openobject-server/+question/196467
>
> Hi OpenERP Team
>
> I can see that Python defaultencoding in OpenERP is ('ascii'). And i have
> found a way to allow it to become ('utf-8') by using this code:
> - import sys
> - sys.setdefaultencoding('utf-8')
>
> Questions
> 1. Is there any impact that may cause system error or others if i set the
> defaultencoding to ('utf-8')?
> 2. Is there any way to change the defaultencoding in OpenERP library /
> configuration / setting? (so i don't need to use import sys,
> sys.setdefaultencoding('utf-8') in every .py file)
>
> Thanks
>
> John Chen
>
> --
> You received this question notification because you are a member of
> OpenERP Committers, which is an answer contact for OpenERP Server.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openerp-community
> More help   : https://help.launchpad.net/ListHelp
>

-- 
You received this question notification because you are a member of
OpenERP Committers, which is an answer contact for OpenERP Server.