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

Leonardo Rochael Almeida leorochael at gmail.com
Tue Sep 8 07:04:08 EDT 2009


Hi,

This is not a grok bug, but a long standing bug in the doctest
infrastructure of Python itself. See:

https://bugs.launchpad.net/launchpad-foundations/+bug/69988
http://bugs.python.org/issue1080727
http://bugs.python.org/issue1293741

On Tue, Sep 8, 2009 at 11:23, grokomobil<battlefox at gmail.com> wrote:
>
> 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:
>
> http://pastie.org/private/jdugghk4514hlx006uvkkg
>
>
> 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.
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev
>


More information about the Grok-dev mailing list