[Zope] html text entities in forms

Mark James Adams mark@raysend.com
Tue, 24 Jul 2001 15:53:41 -0400


I have a web form where users enter plain text with HTML entity 
characters (the users are foreign language instructors who need to enter 
accented characters).

When the form is submitted, the HTML entities are properly stored. 
However, some browsers on Windows display the entities rather than the 
equivalent HTML entity (ie, a with a ` above it, rather than à).

I noticed that when the ZMI displays forms, it translates all the HTML 
markup characters into HTML entities. Thus, somthing like:

<dtml-var standard_html_header>
<h2><dtml-var title_or_id></h2>
<p>
This is the <dtml-var id> Document.
</p>
<dtml-var standard_html_footer>

is actually:

&lt;dtml-var standard_html_header&gt;
&lt;h2&gt;&lt;dtml-var title_or_id&gt;&lt;/h2&gt;
&lt;p&gt;
This is the &lt;dtml-var id&gt; Document.
&lt;/p&gt;
&lt;dtml-var standard_html_footer&gt;

in the ZMI source code.

When "Save Changes" is clicked, Zope obviously then translates the 
&lt;'s and &gt;'s back into < and >. Similarly, HTML entities become 
&amp;agrave; in the forms, but the &amp's are translated back into &'s.

How would I go about doing this in my own forms by taking advantage of a 
functionality that already seems built into Zope?

--
Mark James Adams
mark@raysend.com