Martin Bless wrote: > What's a good way to encode and decode those entities like € or > € ?
Hmm, since you provide code, I'm not quite sure what your actual question is. So I'll just comment on the code here. > def entity2uc(entity): > """Convert entity like { to unichr. > > Return (result,True) on success or (input string, False) > otherwise. Example: > entity2cp('€') -> (u'\u20ac',True) > entity2cp('€') -> (u'\u20ac',True) > entity2cp('€') -> (u'\u20ac',True) > entity2cp('&foobar;') -> ('&foobar;',False) > """ Is there a reason why you return a tuple instead of just returning the converted result and raising an exception if the conversion fails? Stefan -- http://mail.python.org/mailman/listinfo/python-list