![]() |
Available news archives:
comp.lang.tcl
-
comp.lang.python
-
comp.security.firewalls
-
sci.crypt -
comp.lang.php -
comp.lang.javascript
|
|
comp.lang.python archiveRe: 'ascii' codec can't encode character u'\u2013'
From: deelan <ggg@zzz.it>
Date: Fri Sep 30 2005 - 15:48:44 CEST
thomas Armstrong wrote:
well, to start it's not the best way to do an update,
query = "UPDATE blogs_news SET text = %s WHERE id=%s"
so mysqldb will take care to quote text_extrated automatically. this
apart for this, IIRC feedparser returns text as unicode strings, and
you have to decide:
* switch your mysql db to utf-8 and encode stuff before
* lose those characters that cannot be mapped into latin-1,
text_extrated.encode('latin-1', errors='replace')
so unrecognized chars will be replaced by ?
also, mysqldb has some support to manage unicode objects directly, but
HTH.
-- deelan, #1 fan of adriana lima! <http://www.deelan.com/>Received on Sat Oct 15 04:00:04 2005 |