[Zope] Restructured Text and High ASCII

Casey Duncan casey@zope.com
Wed, 30 Apr 2003 23:01:51 -0400


On Wednesday 30 April 2003 10:00 pm, Steve McMahon wrote:
> Thanks to Andreas' great work on the reStructured Text backport, I've=20
> been able to offer it up for experimentation as an alternative to=20
> structured text. But ... we've immediately run into encoding problems=20
> with text copied-and-pasted from Windows apps. The texts have high asci=
i=20
> (ord > 127) which might produce unexpected results in structured text,=20
> but didn't break anything. Rendering as reStructured Text produces the=20
> exception:
>=20
> Error type: UnicodeError
> Error value: ASCII encoding error: ordinal not in range(128)
>=20
> I'm woefully ignorant on alternative encodings. Anyone got a simple=20
> Python recipe I can use to wrap user-submitted text so that it won't=20
> bust docutils?
>=20
> Thanks! Steve

Add the following code to a sitecustomize.py module in your python's=20
site-packages:

import sys
sys.setdefaultencoding('latin-1')

hth,

-Casey