"convert" string to bytes without changing data (encoding)

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Mar 29 21:10:35 EDT 2012


On Thu, 29 Mar 2012 17:36:34 +0000, Prasad, Ramit wrote:

>> > Technically, ASCII goes up to 256 but they are not A-z letters.
>> >
>> Technically, ASCII is 7-bit, so it goes up to 127.
> 
>> No, ASCII only defines 0-127.  Values >=128 are not ASCII.
>> 
>> >From https://en.wikipedia.org/wiki/ASCII:
>> 
>>   ASCII includes definitions for 128 characters: 33 are non-printing
>>   control characters (now mostly obsolete) that affect how text and
>>   space is processed and 95 printable characters, including the space
>>   (which is considered an invisible graphic).
> 
> 
> Doh! I was mistaking extended ASCII for ASCII. Thanks for the
> correction.

There actually is no such thing as "extended ASCII" -- there is a whole 
series of many different "extended ASCIIs". If you look at the encodings 
available in (for example) Thunderbird, many of the ISO-8859-* and 
Windows-* encodings are "extended ASCII" in the sense that they extend 
ASCII to include bytes 128-255. Unfortunately they all extend ASCII in a 
different way (hence they are different encodings).


-- 
Steven



More information about the Python-list mailing list