As promised at PyCon in March, I have just checked in support for a
new "Encoding:" header for PDOGenerator.py, defaulting to "latin-1".
At the same time, I simplified the rst_html.py glue code. (Got the
checkin messages mixed up, sorry.) A recent Docutils is needed [1]_,
and Python 2.3+ is required for non-Latin-1 output. For an example of
the input and output, see
http://python.net/~goodger/tmp/test.html
http://python.net/~goodger/tmp/test.ht
If you see garbage characters in the lines between "Python fits your
brain!" and "Python Software Foundation", your OS or browser can't
handle Japanese. If you see garbage characters anywhere else, your OS
or browser is retarded ;-)
No changes to the Makefile are needed.
I thought about extending the "Content-type" header as in email & web
pages, but a new "Encoding" header was easier. Which is better?
Encoding: ISO-8859-1
or
Content-type: text/x-rst; charset=ISO-8859-1
Also, I considered adding support for an Emacs top-turd like
-*- coding: iso-8859-1 -*-
But then the .ht file would no longer be RFC-2822-compliant. Instead,
a bottom-turd works fine:
Local Variables:
coding: utf-8
End:
.. [1] The latest Docutils is *mostly* installed on creosote.
setup.py tried to install the rst2html.py script in /usr/bin, but
permissions prevented it. This brings up a couple of points:
* Why is Distutils installing in /usr/bin, and not /usr/local/bin?
Isn't /usr/local/bin a better default?
* I tried sudo'ing the install, but I don't seem to be on the
sudoers list on creosote. So I couldn't install Docutils for
Python 2.3 at all. Could somebody add me to sudoers please (or
copy my ssh key to root)?
--
David Goodger <http://python.net/~goodger>
|