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

jmfauth wxjmfauth at gmail.com
Mon Sep 12 10:47:00 EDT 2011


On 12 sep, 10:49, Steven D'Aprano <steve
+comp.lang.pyt... at pearwood.info> wrote:
>
> Even with a source code encoding, you will probably have problems with
> source files including \xe2 and other "bad" chars. Unless they happen to
> fall inside a quoted string literal, I would expect to get a SyntaxError.
>

This is absurd and a complete non sense. The purpose
of a coding directive is to inform the engine, which
is processing a text file, about the "language" it
has to speak. Can be a html, py or tex file.
If you have problem, it's probably a mismatch between
your coding directive and the real coding of the
file. Typical case: ascii/utf-8 without signature.

jmf



More information about the Python-list mailing list