UnicodeDecodeError issue

Chris Angelico rosuav at gmail.com
Wed Sep 4 23:59:17 EDT 2013


On Thu, Sep 5, 2013 at 1:07 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> Technically, it's not ASCII, since ASCII only knows about bytes \x00
> through \x7F (decimal 0 through 127). That's why it isn't correct to
> describe Python bytes strings as "ASCII strings". They're byte strings
> that happen to be displayed as ASCII-plus-other-stuff.

The line of code is itself entirely ASCII. The sequence REVERSE
SOLIDUS, LATIN SMALL LETTER X, LATIN SMALL LETTER B, DIGIT SIX is four
Unicode characters that are in the ASCII set. That Python interprets
them as representing the byte value 182 doesn't change that; the line
of code *is* ASCII.

ChrisA



More information about the Python-list mailing list