<!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. 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. 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 …</FONT></P>
<P><FONT SIZE=2 FACE="Arial">I use UTF-8 *everywhere* (My PT files, .py files, etc … all UTF-8). The web pages come out UTF-8 … I've even switched the ZMI to UTF-8. 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"><meta name="description" xml:lang="fra"</FONT>
<BR> <FONT SIZE=2 FACE="Arial">content="..."</FONT>
<BR> <FONT SIZE=2 FACE="Arial">i18n:attributes="content" i18n:target="string:fr" /></FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">The value of i18n:target 'string:fr' has always been a str from the beginning. 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 -> check out on different machine).</FONT></P>
<P><FONT SIZE=2 FACE="Arial">Anyone know where this difference might come from? 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>