How deal with the coding

MRAB python at mrabarnett.plus.com
Thu Apr 21 11:54:45 EDT 2011


On 21/04/2011 07:27, 1011_wxy wrote:
> Dear All:
> I got a coding problem when I use python to read html from web which is
> encode with gb2312,
> ater I insert the data I read from web into Oracle DB with coding gbk, I
> found messy code by select from PL/SQL.
> I tried the way ".encode('gbk','ignore')" before insert Oracle by using
> cx_Oracle,but not effective.
> How can I deal with the coding?
>
It's probably better to use UTF-8 wherever possible.

Decode to Unicode and work with Unicode strings.

Use UTF-8 when you want to store or transmit data.

Use another encoding _only_ if it's required by a legacy application (an 
old application which requires that encoding.).



More information about the Python-list mailing list