Hi guys
I writing a template with the iso8859-1 encoding, I'm setting it
throught the line above:
<?xml version='1.0' encoding='iso-8859-1'?>
...
I'm serializing it with this encoding too, using the code above:
...
source = open(filename).read()
template = kid.Template(source=source, servlet=self, **kw)
return template.serialize(output="html", fragment=True, encoding="iso8859-1")
Then I trying to write some variable with special caracters in the
template (these special caracters are iso8859-1 encoding specific):
...
<p py:content="servlet.someVariable">Some variable content</p>
...
It raises an exception: UnicodeDecodeError: 'ascii' codec can't decode
byte 0xe1 in position 11: ordinal not in range(128)
The problem seems to be in the pull.py file, in the line 191:
...
return unicode(value, encoding)
I don't know where, but somewhere the encoding is set to ascii, I
think if I set the encoding to iso8859-1 in the template.serialize
method, the encoding value (on the unicode method of pull module)
should be iso8859-1. I couldn't find where the ascii encoding is being
set, so I don't know how to fix it, is this a bug?
I ned to decode my variable as above:
...
<p py:content="servlet.someVariable.decode('iso8859-1')">Some
variable content</p>
...
This is the same of unicode(servlet.someVariable, 'iso8859-1').
Thanks in advance,
Regards.
--
Michel Thadeu Sabchuk
Curitiba - Brasil
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
kid-template-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kid-template-discuss