[Zope3-dev] Unicode in structured text

Craig Ewington ewington at adelphia.net
Fri Sep 3 22:45:33 EDT 2004


I get the following error message when I attempt to render structured  
text content that contains unicode characters...

------------------------------------------------------------------------ 
------------------------------------------
...
  File "/Users/crewington/ZopeX3/src/zope/app/renderer/stx.py", line 54,  
in render
     doc = Document()(str(self.context))
UnicodeEncodeError: 'ascii' codec can't encode characters in position  
25-32: ordinal not in range(128)
------------------------------------------------------------------------ 
------------------------------------------


If I make a one line change at line 54 of  src/zope/app/renderer/stx.py  
as follows:

current:               doc = Document()(str(self.context))
my version:        doc = Document()(unicode(self.context))

then my unicode content gets rendered correctly.  I'm very much a  
Python newbie, so I'd like to know if this fix looks correct to those  
of you with more experience?

Thanks,

Craig Ewington



More information about the Zope3-dev mailing list