<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:12pt;font-family:Arial">
<p>On Thursday 26 June 2008 15:12, Andreas Jung wrote:</p>
<p>> --On 26. Juni 2008 14:09:50 +0000 Garry Saddington</p>
<p>></p>
<p>> <garry@schoolteachers.co.uk> wrote:</p>
<p>> > I am using Zope 2.9 connected to a Posgres DB via psycopg. My database</p>
<p>> > encoding is UTF8. I am getting the following error when users try to</p>
<p>> > insert text in the database containing £ signs: ERROR: invalid byte</p>
<p>> > sequence for encoding "UTF8": 0xa3</p>
<p>> ></p>
<p>> > This is due to the encoding of a £ sign in the text being sent to the DB.</p>
<p>> > My question then is how do I make sure that all encodings submiitted from</p>
<p>> > forms are in the correct UTF8 format? Regards</p>
<p>></p>
<p>> Use ensure that the HTML page uses UTF-8 as encoding</p>
<p>> (either using <meta-equiv...> within the HTML page or by sending</p>
<p>></p>
<p>> content-type: text/html; charset=utf-8</p>
<p>></p>
<p>> as HTTP header.</p>
<p>></p>
<p>I have taken this a little further after trying all suggestions in the thread with no success and looked into zope.conf, specifically:</p>
<p></p>
<p><span style="font-style:italic"># Directive: default_zpublisher_encoding</span></p>
<p><span style="font-style:italic">#</span></p>
<p><span style="font-style:italic"># Description:</span></p>
<p><span style="font-style:italic"># This controls what character set is used to encode unicode</span></p>
<p><span style="font-style:italic"># data that reaches ZPublisher without any other specified encoding.</span></p>
<p><span style="font-style:italic">#</span></p>
<p><span style="font-style:italic"># Default: iso-8859-15</span></p>
<p><span style="font-style:italic">#</span></p>
<p><span style="font-style:italic"># Example:</span></p>
<p><span style="font-style:italic">#</span></p>
<p><span style="font-style:italic"># default_zpublisher_encoding utf-8</span></p>
<p></p>
<p>As my pages all report as iso-8859-15 I thought a change here would help, but this happens:</p>
<p></p>
<p><span style="font-style:italic"> from OFS.content_types import guess_content_type</span></p>
<p><span style="font-style:italic">Error: 'default_zpublisher_encoding' is not a known key name</span></p>
<p></p>
<p>It works on this: Zope Version (Zope 2.9.0, python 2.4.2, win32) </p>
<p></p>
<p>And fails on this: Zope Version (Zope 2.9.0-, python 2.4.5, linux2) </p>
<p></p>
<p>Any further help would be appreciated. </p>
<p>regards</p>
<p>Garry</p>
<p></p>
<p>ps. just noticed the typo (not mine) in zope.conf <span style="font-style:italic"> - default_zpublisher_encoding </span>should be<span style="font-style:italic"> default-zpublisher-encoding</span></p>
<p>all sorted</p>
<p></p>
<p></p>
<p></p>
</body></html>