<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-06-29 20:46 GMT-05:00 Alberto Berti <span dir="ltr"><<a href="mailto:azazel@metapensiero.it" target="_blank">azazel@metapensiero.it</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">>>>>> "Miguel" == Miguel Beltran R <<a href="mailto:yourpadre@gmail.com">yourpadre@gmail.com</a>> writes:<br>
<br>
<br>
    Miguel> After search a while, someone can confirm if I undestand it well? the<br>
    Miguel> problem is because it is trying to decode to "ascii" instead of "iso-8859-1"<br>
<br>
    Miguel> if it's true, why is doing it? I set to use iso-8859-1 in my conf file<br>
<br>
    Miguel> 2016-06-28 16:56 GMT-05:00 Miguel Beltran R. <<a href="mailto:yourpadre@gmail.com">yourpadre@gmail.com</a>>:<br>
<span class=""><br>
    >> Using the ZMI if I check the "Z SQL Method" the data is displayed<br>
    >> correctly, but using a "page template" it gives me this error<br>
    >><br>
    >><br>
</span>    >> *Expression: <StringExpr u' ${repeat/items/number}. ${items/nombre}'>*<br>
    >><br>
    >> - Module zope.tales.expressions, line 263, in __call__UnicodeDecodeError:<br>
<span class="">    >> 'ascii' codec can't decode byte 0xf3 in position 10: ordinal not in<br>
    >> range(128)<br>
    >><br>
<br>
</span>this is due probably because the template engine tries to convert a<br>
string into an unicode, but it doesn't know the charset of your data, so<br>
it's trying to use the default encoding as set in<br>
/usr/lib/python2.7/site.py during interpreter bootstrap. If you are<br>
using a good database you can trust your data and and let the database<br>
connector (the encoding should be settable somewhere in the connector or<br>
Z SQL method conf, i don't remember since i don't use them anymore)<br>
convert the strings to unicodes for you.<br>
<br>
If you have something like MySQL you can't always trust that the data in<br>
the db is in the expected encoding because some of its table engine<br>
simply don't do any check on the input. If this is your case, it will be<br>
more problematic.<br>
<br>
In my experience, setting a default encoding in the config file didn't<br>
always fix the problem.<br>
<br>
As a last resort you can tweak the site.py, but really if there issues<br>
with data's encoding this doesn't mean you solved the problem. Likely<br>
the user will see wrong charachters where non-ascii ones are supposed to<br>
be.<br>
</blockquote></div><br><br clear="all"></div><div class="gmail_extra">Thanks Alberto!!! :D <br><br></div><div class="gmail_extra">Changing the enconding in the site.py file made the trick.<br><br></div><div class="gmail_extra">To some zope developer in the list, why is not taking the enconding from the zope.conf file? Do I must open a ticket?<br><br><br></div><div class="gmail_extra">-- <br><div class="gmail_signature" data-smartmail="gmail_signature">________________________________________<br>Lo bueno de vivir un dia mas<br>es saber que nos queda un dia menos de vida</div>
</div></div>