Unicode issue on Windows cmd line

jeffg jeffgemail at gmail.com
Wed Feb 11 20:11:37 EST 2009


On Feb 11, 6:30 pm, "Martin v. Löwis" <mar... at v.loewis.de> wrote:
> > Thanks, I ended up using encode('iso-8859-15', "replace")
> > Perhaps more up to date than cp1252...??
>
> > It still didn't print correctly, but it did write correctly, which was
> > my main problem.
>
> If you encode as iso-8859-15, but this is not what your terminal
> expects, it certainly won't print correctly. To get correct printing,
> the output encoding must be the same as the terminal encoding. If the
> terminal encoding is not up to date (as you consider cp1252), then
> the output encoding should not be up to date, either.
>
> If you want a modern encoding that supports all of Unicode, and you
> don't care whether the output is legible, use UTF-8.
>
> Regards,
> Martin

I did try UTF-8 but it produced the upper case character instead of
the proper lower case, so the output was incorrect for the unicode
supplied.
I think both 8859-15 and cp1252 produced the correct output, but I
figured 8859-15 would have additional character support (though not
sure this is the case - if it is not, please let me know and I'll use
1252).  I'm dealing with large data sets and this just happend to be
one small example.  I want to have the best ability to write future
unicode characters properly based on running from the windows command
line (unless there is a better way to do it on windows).



More information about the Python-list mailing list