Thanks Mark, that is a great suggestion!
> You can also replace the Unicode replacement character U+FFFD with a valid
> cp437 character before displaying it:
>
> >>> b'\x80abc'.decode('utf8','replace').replace('\ufffd','?')
>
> '?abc'
>
--
http://mail.python.org/mailman/listinfo/python-list
Thanks Benjamin for solving the mystery of where the cp437 usage was
coming from.
So b'\x80abc'.decode("utf-8", "replace") was working properly but then
when the interactive prompt tried to print it, it was basically taking
the results and doing a
encode('cp437', 'strict') which failed because of
"Dave Angel" wrote in message
news:4ae43150.9010...@ieee.org...
Joe wrote:
For the reason BK explained, the important difference is that I ran in
the IDLE shell, which handles screen printing of unicode better ;-)
Something still does not seem right here to me.
In the example above the by
Joe wrote:
For the reason BK explained, the important difference is that I ran in
the IDLE shell, which handles screen printing of unicode better ;-)
Something still does not seem right here to me.
In the example above the bytes were decoded to 'UTF-8' with the
*nope* you're decoding
On Sat, Oct 24, 2009 at 8:47 PM, Joe wrote:
>> For the reason BK explained, the important difference is that I ran in
>> the IDLE shell, which handles screen printing of unicode better ;-)
>
> Something still does not seem right here to me.
>
> In the example above the bytes were decoded to 'UTF-8
> For the reason BK explained, the important difference is that I ran in
> the IDLE shell, which handles screen printing of unicode better ;-)
Something still does not seem right here to me.
In the example above the bytes were decoded to 'UTF-8' with the
replace option so any characters that were
Joe wrote:
Thanks for your response.
Please provide more information
The Python 3.1.1 documentation has the following example:
Where? I could not find them
http://docs.python.org/3.1/howto/unicode.html#unicode-howto
Scroll down the page about half way to the "The String Type" section.
Th
Thanks for your response.
> Please provide more information
>
> > The Python 3.1.1 documentation has the following example:
>
> Where? I could not find them
http://docs.python.org/3.1/howto/unicode.html#unicode-howto
Scroll down the page about half way to the "The String Type" section.
The exa
On Sat, Oct 24, 2009 at 1:09 PM, Joe wrote:
> The Python 3.1.1 documentation has the following example:
>
b'\x80abc'.decode("utf-8", "strict")
> Traceback (most recent call last):
> File "", line 1, in ?
> UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 0:
>
Joe wrote:
Please provide more information
The Python 3.1.1 documentation has the following example:
Where? I could not find them
b'\x80abc'.decode("utf-8", "strict")
Traceback (most recent call last):
File "", line 1, in ?
UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in posit
The Python 3.1.1 documentation has the following example:
>>> b'\x80abc'.decode("utf-8", "strict")
Traceback (most recent call last):
File "", line 1, in ?
UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 0:
unexpected code byte
>>> b'\x80abc'.decode("utf-8
11 matches
Mail list logo