[Zope] Problem with links containing non-ascii characters in StructuredText

Maurits van Rees maurits at vanrees.org
Fri Sep 30 07:03:47 EDT 2005


On Fri, Sep 30, 2005 at 12:38:04PM +0200, Andreas Jung wrote:
> StructuredText does not work with UTF8 (when you mean this by mentioning
> unicode). There is a utf-8 patch for STX but this has other problems.
> Means: Don't use STX with multi-byte encodings...instead use reST.

Okay, that's clear now, thanks.  I have got it working now:

In etc/zope.conf:

rest-input-encoding utf-8
rest-output-encoding utf-8
locale nl_NL.utf8 at euro

Hm, now it seems to function without that locale setting as well.
Maybe Zope reads the locale correctly from my system already.

Anyway, my script is now:
------------------
import Products.PythonScripts.standard

print """
<html><head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head><body>
"""
text="""
.. _Zope: http://www.zope.org/ 

I like à `Zöpe platform`__.

__ Zope_ 

"""
ppsr=Products.PythonScripts.standard.restructured_text
print "ppsr(text):"
print ppsr(text)
print "</body>"

return printed
------------------

So no more switching from iso to utf with:

print ppsr(unicode(text,'iso-8859-1').encode('utf-8'))

So far as I can see this solves my problems.

Thanks for thinking with me, Andreas.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [Dutch/Nederlands] 
Public GnuPG key:  http://maurits.vanrees.org/var/gpgkey.asc
"It can seem like you're doing just fine,
but the creep's creeping into your mind." - Neal Morse
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope/attachments/20050930/b3c96c77/attachment.bin


More information about the Zope mailing list