<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=text/html;charset=Windows-1252 http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18702"></HEAD>
<BODY style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 15px" 
id=MailContainerBody leftMargin=0 topMargin=0 CanvasTabStop="true" 
name="Compose message area">
<DIV><FONT color=#000080 face=Garamond>I forgot to add that I'm using 
elementtree to process the xml files and don't (usually) have any problems with 
that.&nbsp; Plus,&nbsp;the workaround that works is to encode each elementtree 
output ie.:</FONT></DIV>
<DIV><FONT color=#000080 face=Garamond></FONT>&nbsp;</DIV>
<DIV><FONT color=#000080 face=Garamond>thisxmlline = 
thisxmlline.encode('utf8')</FONT></DIV>
<DIV><FONT color=#000080 face=Garamond></FONT>&nbsp;</DIV>
<DIV><FONT color=#000080 face=Garamond>But, this seems odd to me as isn't it 
already being processed as utf-8?</FONT></DIV>
<DIV><FONT color=#000080 face=Garamond></FONT>&nbsp;</DIV>
<DIV><FONT color=#000080 face=Garamond>Dinesh</FONT></DIV>
<DIV><FONT color=#000080 face=Garamond></FONT>&nbsp;</DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=dineshbvadhia@hotmail.com 
href="mailto:dineshbvadhia@hotmail.com">Dinesh B Vadhia</A> </DIV>
<DIV><B>Sent:</B> Thursday, June 04, 2009 6:47 AM</DIV>
<DIV><B>To:</B> <A title=tutor@python.org 
href="mailto:tutor@python.org">tutor@python.org</A> </DIV>
<DIV><B>Subject:</B> unicode, utf-8 problem again</DIV></DIV></DIV>
<DIV><BR></DIV>
<DIV><FONT color=#000080 face=Garamond>Hi!&nbsp; I'm processing a large number 
of xml files that are all declared as utf-8 encoded in the header 
ie.</FONT></DIV>
<DIV><FONT color=#000080 face=Garamond></FONT>&nbsp;</DIV>
<DIV><FONT color=#000080 face=Garamond>&lt;?xml version="1.0" 
encoding="UTF-8"?&gt;</FONT></DIV>
<DIV><FONT color=#000080 face=Garamond></FONT>&nbsp;</DIV>
<DIV><FONT color=#000080 face=Garamond>My Python environment has been set for 
'utf-8' through site.py.&nbsp; Additionally, t</FONT><FONT color=#000080 
face=Garamond>he top of each program/module has the declaration:</FONT></DIV>
<DIV><FONT color=#000080 face=Garamond></FONT>&nbsp;</DIV>
<DIV><FONT color=#000080 face=Garamond># -*- coding: utf-8 -*-</FONT></DIV>
<DIV><FONT color=#000080 face=Garamond></FONT>&nbsp;</DIV>
<DIV><FONT color=#000080 face=Garamond>But, I still get this error:</FONT><FONT 
color=#000080 face=Garamond></FONT></DIV>
<DIV><FONT color=#000080 face=Garamond></FONT>&nbsp;</DIV>
<DIV><FONT color=#000080 face=Garamond>Traceback (most recent call 
last):<BR>...</FONT></DIV>
<DIV><FONT color=#000080 face=Garamond>UnicodeEncodeError: 'ascii' codec can't 
encode character u'\u201c' in position 76: ordinal not in 
range(128)</FONT></DIV>
<DIV><FONT color=#000080 face=Garamond></FONT>&nbsp;</DIV>
<DIV><FONT color=#000080 face=Garamond>What am I missing?</FONT></DIV>
<DIV><FONT color=#000080 face=Garamond></FONT>&nbsp;</DIV>
<DIV><FONT color=#000080 face=Garamond>Dinesh</FONT></DIV>
<DIV><FONT color=#000080 face=Garamond></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=#000080 face=Garamond></FONT>&nbsp;</DIV></BODY></HTML>