<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7651.59">
<TITLE>UTF encoding problem w/ ZPT's (No, not the usual :)</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=2 FACE="Arial">G'day,</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">So I've been working on this project for some time, and all is well.&nbsp; Now for the first time I migreate my product code to a brand new Zope installation on the production systems.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Development and production systems are as identical as they can be.&nbsp; In this case, they both have the same default locale (as indicated by the locale command in the shell), same OS version, same zope.conf settings (default-zpublisher-encoding and locale), etc &#8230;</FONT></P>

<P><FONT SIZE=2 FACE="Arial">I use UTF-8 *everywhere* (My PT files, .py files, etc &#8230; all UTF-8).&nbsp; The web pages come out UTF-8 &#8230; I've even switched the ZMI to UTF-8.&nbsp; All works well on the development side.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Now on the production side, I'm getting an encoding related error.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Where I have something like:</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">&lt;meta name=&quot;description&quot; xml:lang=&quot;fra&quot;</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">content=&quot;...&quot;</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">i18n:attributes=&quot;content&quot; i18n:target=&quot;string:fr&quot; /&gt;</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">The value of i18n:target 'string:fr' has always been a str from the beginning.&nbsp; Now, on the new system, it comes through as a unicode string!</FONT></P>

<P><FONT SIZE=2 FACE="Arial">So I see this:</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Error Type: TypeError</FONT>

<BR><FONT SIZE=2 FACE="Arial">Error Value: 'unicode' object is not callable</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Since the i18n:target implementation is my own, I can fix the code of course, but now I'm worried this might happen somewhere else, and I don't understand why.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">The only difference I can see is that the file went through subversion in the process (commit -&gt; check out on different machine).</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Anyone know where this difference might come from?&nbsp; In other words, how does the PT engine decide whether that value shuld be a unicode string or a regular one?</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Any insight would be much appreciated :)</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Thanks,</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Jean-François Doyon</FONT>

<BR><FONT SIZE=2 FACE="Arial">Data Dissemination Division | Division de la diffusion des données</FONT>

<BR><FONT SIZE=2 FACE="Arial">Data Management and Dissemination Branch | Direction de la gestion et de la diffusion des données</FONT>

<BR><FONT SIZE=2 FACE="Arial">Earth Sciences Sector | Secteur des sciences de la Terre</FONT>

<BR><FONT SIZE=2 FACE="Arial">Natural Resources Canada | Ressources naturelles Canada</FONT>

<BR><FONT SIZE=2 FACE="Arial">Ottawa, Canada K1A 0E9</FONT>

<BR><FONT SIZE=2 FACE="Arial">jdoyon@nrcan-rncan.gc.ca</FONT>

<BR><FONT SIZE=2 FACE="Arial">Telephone | Téléphone 613-992-4902</FONT>

<BR><FONT SIZE=2 FACE="Arial">Facsimile | Télécopieur 613-947-2410</FONT>

<BR><FONT SIZE=2 FACE="Arial">Teletypewriter | Téléimprimeur 613-996-4397</FONT>

<BR><FONT SIZE=2 FACE="Arial">Government of Canada | Gouvernement du Canada</FONT>
</P>

</BODY>
</HTML>