Write Unicode str as utf-8

Erik Max Francis max at alcyone.com
Mon Feb 14 20:32:29 EST 2005


kent sin wrote:

> Python support unicode, but some library don't. Write
> is one of them. 
> 
> When writing a csv file, The rows contains numbers and
> unicode str. It is a little pain to first convert all
> unicode str to utf-8 before writing the row.

Why?

	S = U.encode('utf-8')

> Are there anyway I can patch python such that It will
> convert the unicode string to utf-8 before the write?
> Where should I start?

codecs.open

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   Describe a circle, stroke its back and it turns vicious.
   -- Ionesco



More information about the Python-list mailing list