Skip to content
Browse files

Set explicitely the output encoding

  • Loading branch information...
1 parent 5f244bb commit 1fa84d7556a3bfa64e6b025282399ec5e45aa3a1 @bortzmeyer committed Dec 22, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 SeenThis.py
View
4 SeenThis.py
@@ -34,6 +34,7 @@
<summary tal:content="message"/>
</entry>
"""
+outsideencoding = "UTF-8"
myencoding = locale.getpreferredencoding()
if myencoding is None:
myencoding='UTF-8'
@@ -174,7 +175,8 @@ def post(self, message):
context = simpleTALES.Context(allowPythonPath=False)
context.addGlobal ("message", unicode(message, encoding=myencoding))
result = simpleTALUtils.FastStringOutput()
- self.template.expand (context, result)
+ self.template.expand (context, result, outputEncoding=outsideencoding)
+ print result.getvalue()
request = urllib2.Request(url=create_endpoint,
data=result.getvalue())
self._add_headers(request, post=True)

0 comments on commit 1fa84d7

Please sign in to comment.
Something went wrong with that request. Please try again.