[Zope] Unicode/string question
Chris Muldrow
cmuldrow@fredericksburg.com
Thu, 12 Sep 2002 16:50:35 -0400
I'm having unicode troubles, and I'm not sure if I'm running into a "Zope
doesn't do that" problem or perhaps I'm just an idiot.
Basically, I've an external method called xmlheadparse, which returns a list
of lists of headlines and URLs, given a an xml file on our server.
[[Headline here, url here],[headline2 here, url2 here]]
I process the list into an html page of links with the following Zope Python
script, where urlfeed is the name of the xml file I want to display:
returnedhtml=""
storypooge=context.xmlheadparse('/var/www/ap/'+urlfeed)
for x in range(len(storypooge)):
returnedhtml=returnedhtml+'• <a
href="/News/apmethods/apstory?urlfeed='
url=context.nntpnamestripper(storypooge[x][1])
headline=storypooge[x][0]
returnedhtml=returnedhtml+url+'">'+headline+'</a><br />\n'
return returnedhtml
This works fine with English text, but I also have Spanish headlines in some
of the files. When run through this script, I get the following error:
Error Type: UnicodeError
Error Value: ASCII encoding error: ordinal not in range(128)
The weird thing is, I can get just the unicode headline to display, but not
concatenated into the rest of the stuff. I can't seem to encode all of the
pieces into the same format. What am I doing wrong?
Thanks, Chris