UTF-8 usage in Python 2.0
Fran=?ISO-8859-1?B?5w==?=ois Granger
fgranger at teleprosoft.com
Mon Oct 30 07:39:53 EST 2000
in article snwK5.3183$jv2.357271 at newsc.telia.net, Fredrik Lundh at
effbot at telia.com wrote on 28/10/00 9:46:
> François Granger wrote:
>> 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.
>
> # macroman to latin1
> outdata = unicode(data, "macroman").encode("latin1")
Even simpler !
Next question, what if my source is encoded in html entity ?
I wrote this really stupide piece of (can I call it ?) code to serve as a
pre-filter:
from entity88591 import entitydefs
#...
def htmlTo88591(s):
for entity in entitydefs.keys():
s=string.replace(s, '&' + entity + ';', entitydefs[entity])
return s
I guess that someone will write one line to substitute to this ??
> I've-never-met-macro-man-ly yrs /F
Neither me, is it someone I should meet ?
;-)
Salutations,
Francois Granger
--
fgranger at teleprosoft.com - <http://www.teleprosoft.com>
tel: +33 1 41 88 48 00 - Fax: + 33 1 41 88 04 90
More information about the Python-list
mailing list