Printing Filenames with non-Ascii-Characters

Max M maxm at mxm.dk
Wed Feb 2 04:39:41 EST 2005


Marian Aldenhövel wrote:

>  > If you're printing to the console, modern Pythons will try to guess the
>  > console's encoding (e.g. cp850).
> 
> But it seems to have quessed wrong. I don't blame it, I would not know of
> any way to reliably figure out this setting.

Have you set the coding cookie in your file?

Try adding this as the first or second line.

# -*- coding: cp850 -*-

Python will then know how your file is encoded

-- 

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science



More information about the Python-list mailing list