[Grok-dev] Can't print browser.content of pages using unicode chars.

grokomobil battlefox at gmail.com
Tue Sep 8 05:23:29 EDT 2009

To test my grok project, I use the zope.testbrowser module. Everything works
fine as long as I do not try to print the browser.content of a page that
uses utf-8 charset.

What I did:

1. Added the following Meta-Tag to the headline of my Template-pt:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>'

2. Added the following line to the top of my Python-file:
# coding=utf-8

3. Set the language of my console (LANG etc.. to "to de_DE_UTF8")

4. Added the following to my test.txt:
print browser.contents

When I run the test with -t test.txt, it will give me a UnicodeDecodeError:


Several attempts to convert the value of browser.contents with
(encode('utf-8')/decode('utf-8') failed.

Does anyone have an idea how to print browser.contents containing unicode?

View this message in context: http://www.nabble.com/Can%27t-print-browser.content-of-pages-using-unicode-chars.-tp25342633p25342633.html
Sent from the Grok mailing list archive at Nabble.com.

More information about the Grok-dev mailing list