Least-lossy string.encode to us-ascii?

Terry Reedy tjreedy at udel.edu
Thu Sep 13 19:36:56 EDT 2012


On 9/13/2012 5:26 PM, Tim Chase wrote:
> I've got a bunch of text in Portuguese and to transmit them, need to
> have them in us-ascii (7-bit).  I'd like to keep as much information
> as possible,just stripping accents, cedillas, tildes, etc.

'keep as much information as possible' would mean an effectively 
lossless transliteration, which you could do with a dict.
{<o-with-accent>: 'o', <c-cedilla>: 'c,' (or pick something that would 
never occur in normal text of the sort you are transmitting), ...}


-- 
Terry Jan Reedy




More information about the Python-list mailing list