[Zope] Unicode/string question
Chris Muldrow
cmuldrow@fredericksburg.com
Fri, 13 Sep 2002 10:12:38 -0400
> You are mixing:
> 1. A unicode string
> 2. A plain 8-bit string with characters outside the ascii range.
>
> Its not clear from the code fragment which strings are the unicode ones, and
> which are not. I suggest you work all in unicode.... You need to convert
> those 8 bit strings into unicode strings by applying a character encoding
> using code like...
>
> myunicodestring = unicode(my8bitstring,'utf-8')
>
>
> ....substitute 'utf-8' for whatever character encoding you are using.
>
>
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]) # this is a string
headline=storypooge[x][0] # This is unicode
returnedhtml=unicode(url, "ascii")
return returnedhtml
When I do this (with any encoding) I get "decoding unicode is not supported"
error