Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #3805

Re: How deal with the coding

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.018
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'python': 0.07; 'from:addr:python': 0.09; 'utf-8': 0.09; 'wrote:': 0.14; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'reply- to:addr:python-list': 0.16; 'transmit': 0.16; 'code': 0.22; 'header:In-Reply-To:1': 0.22; 'insert': 0.22; 'received:84': 0.25; 'tried': 0.27; 'problem': 0.29; 'unicode': 0.29; 'probably': 0.30; 'all:': 0.31; 'strings.': 0.31; 'to:addr:python-list': 0.32; 'another': 0.32; 'store': 0.32; 'data.': 0.33; 'using': 0.34; 'got': 0.34; 'requires': 0.35; 'header:User-Agent:1': 0.35; 'legacy': 0.35; 'oracle': 0.35; 'reply-to:addr:python.org': 0.35; 'data': 0.37; 'subject:with': 0.37; 'skip:" 20': 0.38; 'to:addr:python.org': 0.39; 'how': 0.39; "it's": 0.40; 'dear': 0.64; 'reply-to:no real name:2**0': 0.72; 'header:Reply-To:1': 0.72; 'effective.': 0.84; 'subject:deal': 0.84
X-IronPort-Anti-Spam-Filtered true
X-IronPort-Anti-Spam-Result AoIHAA1SsE3Unw4S/2dsb2JhbACXf41Id8Q3hXYEkjA
Date Thu, 21 Apr 2011 16:54:45 +0100
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9
MIME-Version 1.0
To python-list@python.org
Subject Re: How deal with the coding
References <4950dabe.8450.12f76be171c.Coremail.1011_wxy@163.com>
In-Reply-To <4950dabe.8450.12f76be171c.Coremail.1011_wxy@163.com>
Content-Type text/plain; charset=x-gbk; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To python-list@python.org
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.706.1303401356.9059.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 82.94.164.166
X-Trace 1303401356 news.xs4all.nl 81474 [::ffff:82.94.164.166]:57005
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:3805

Show key headers only | View raw


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.).

Back to comp.lang.python | Previous | Next | Find similar


Thread

Re: How deal with the coding MRAB <python@mrabarnett.plus.com> - 2011-04-21 16:54 +0100

csiph-web