[Pythonmac-SIG] (no subject)
Francois Granger
fgranger@altern.org
Fri, 27 Oct 2000 23:49:25 +0200
I am participating in the translation of Python docs to french. I
works on Mac (at home). Since this doc is to be delivered in
iso-8859-1, grabbing from other scripts, I came with a simple script
wich translate my Mac charset to 8859.
def macTo88591(s):
t=""
for c in s:
if entitydefs.has_key(c):
t=t + entitydefs[c]
else:
t=t+c
return t
The entitydefs is a hacked version of """HTML character entity
references.""" with Mac char replacing html entities as keys.
On the professional side, I receive html files translated to french.
They are coded in html entity. I need to translate them to UTF-8. I
currently use Tidy to do this, but I need to do some manual
modifications after it.
I looked throught the new features of Python 2 but I did not found an
easy way to do something similar to what I did with this 8859
modification.
Any idea or bigginning of solution ?
--
"Computers are like horses; they can sense fear and will act based on
that. Or, look at it like this. If you have a premonition of danger,
maybe you're right." - Adam Engst