Here, let me be a bit more specific. I'll tell you exactly what I'm
doing:

I have an XML template that I'm serving. I'm calling the template like
this from within the controller:

request.content_type = 'text/xml; charset=UTF-8'
m.subexec('/xml.myt')

Then, within the template, I have:

<?xml version="1.0" encoding="utf-8" ?>
<%flags>
    encoding = "utf-8"
</%flags>
...
<name><% item.name.encode('utf-8') | h %></name>
...

When I call the page, I get this error:

Error:
Error(UnicodeDecodeError): 'ascii' codec can't decode byte 0xc2 in
position 49: ordinal not in range(128)

File:
/usr/lib/python2.4/StringIO.py line 107

Context:
104:         """
105:         _complain_ifclosed(self.closed)
106:         if self.buflist:
107:             self.buf += ''.join(self.buflist)
108:             self.buflist = []
109:         if mode == 1:
110:             pos += self.pos

So, it appears that somewhere along the line, Myghty/Pylons is still
trying to encode that piece of output as ASCII instead of UTF-8. I'm
assuming that this is because of Python's default encoding of ASCII for
certain string functions.

Am I missing something?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss
-~----------~----~----~----~------~----~------~--~---

Reply via email to