[Grok-dev] thoughts while writing a tutorial

Brandon Craig Rhodes brandon at rhodesmill.org
Wed Aug 22 12:25:34 EDT 2007

I wrote:

> I am about halfway done, but have run into a problem: adding a
> Unicode character to my tutorial results in an exception, and I
> cannot quite determine what's wrong.

As a follow-up to my post, it turns out that I can temporarily get
things working - and thus continue making progress on my tutorial
without having to re-train myself to not type em-dashes and correctly
matched double-quotes - by making two changes on my system:

 1. Edit /usr/lib/python2.5/site.py and change the line:
      encoding = "ascii" # Default value set by _PyUnicode_Init()
      encoding = "utf8"
    This is a terrible idea, but until Grok/Zope 3 gets fixed, it
    seems the only way to solve the exception I was getting.
    With this change, ./bin/grok2html now runs successfully to
    completion.  But the pages do not render correctly in my browser!

 2. Next, spend a few minutes wondering very, very hard, why - when
    building mini-tutorials - the line
      <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    that clearly appears in doc/template.pt simply disappears from the
    output!  After wondering for a while, stop, and go on to step 3.

 3. In my apache.conf, provide the line
       AddDefaultCharset UTF-8
    to make up for not being able to provide the <meta .../> tag
    mentioned above.  With this change, the rendered tutorials can
    be viewed successfully.

Brandon Craig Rhodes   brandon at rhodesmill.org   http://rhodesmill.org/brandon

More information about the Grok-dev mailing list