How do I automate the removal of all non-ascii characters from my code?

Eric Snow ericsnowcurrently at gmail.com
Mon Sep 12 16:44:01 CEST 2011


On Mon, Sep 12, 2011 at 1:49 AM, Alec Taylor <alec.taylor6 at gmail.com> wrote:
> Good evening,
>
> I have converted ODT to HTML using LibreOffice Writer, because I want
> to convert from HTML to Creole using python-creole. Unfortunately I
> get this error: "File "Convert to Creole.py", line 17
> SyntaxError: Non-ASCII character '\xe2' in file Convert to Creole.py
> on line 18, but no encoding declared; see
> http://www.python.org/peps/pep-0263.html for details".
>
> Unfortunately I can't post my document yet (it's a research paper I'm
> working on), but I'm sure you'll get the same result if you write up a
> document in LibreOffice Writer and add some End Notes.
>
> How do I automate the removal of all non-ascii characters from my code?

Perhaps try "The Unicode Hammer".

http://code.activestate.com/recipes/251871/

-eric

>
> Thanks for all suggestions,
>
> Alec Taylor
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list