[Twisted-Python] Woven unicode

Donovan Preston dp at twistedmatrix.com
Mon Oct 6 22:50:18 EDT 2003

On Oct 6, 2003, at 7:29 PM, Rita Díaz y/o Rodrigo Benenson wrote:

> I have tryed using a meta tag to indicate iso-8859-1 coding and 
> replaced
> u"eló" by u"eló".encode("iso-8859-1"); but that does not work too.

I just happen to be working on this at the moment so you may be in 
luck. The technique that worked for me was to encode the unicode string 
as utf8:


Then override render in your Page subclass, so you can set the 
Content-type header:

class MyPage(page.Page):
	def render(self, request):
		request.setHeader("Content-type", "text/html; charset=utf8")
		return page.Page.render(self, request)

It worked for me, anyway. Hope it works for you!


More information about the Twisted-Python mailing list