Cannot understand the 32-bit encoding of the "Python" string
<p>I am reading the <a href="https://docs.python.org/2/howto/unicode.html" rel="nofollow">Unicode HOWTO</a> of the Python docs to start to really understand Unicode. At the <a href="https://docs.python.org/2/howto/unicode.html#encodings" rel="nofollow">Encodings Paragraph</a> it shows a representation of the "Python" string in a 32-bit integers array. </p>

<p>I don't understand why each char has so many 00s. Like, the char "P" is represented by 0x50 (which I understand, being the hex equivalent for the ASCII ordinal 80). But then it is followed by 3 couples of 00s. What is that? How should I read this representation?</p>

<p>The reason why there are so many zeroes there is because all of those letters are contained in the ASCII set, i.e. occupies one byte (two characters in hexadecimal notation). Unicode encodings are compatible with ASCII like that.</p>

<p>The rest is just filler of the remaining 3 bytes.</p>

<p>It is kind of like taking an original variable declared to be a (unsigned) <code>byte</code>, then copying it to an (unsigned) <code>int32</code> -- you will get a lot of zeroes in the latter, because it is a bigger type.</p>

python unicode