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>A 32-bit integers array consists of, well, 32-bit integers.</p>

<p>A byte is 8 bits, so each character necessarily consists of 4 bytes.</p>

<p>The number is 0x00000050, which is translated into four bytes. You could order them <code>0x50 0x00 0x00 0x00</code> (byte representing most significant numbers at the end -- "little endian") or <code>0x00 0x00 0x00 0x50</code> (least significant at the end -- "big endian"). Different CPUs make different choices for the order, as they note in the paragraph you link to.</p>

<p>If you think this is impractical: they are trying to explain in that paragraph why it is, and why another encoding is typically preferred.</p>

<p>Instead of starting at that article, <a href="http://www.joelonsoftware.com/articles/Unicode.html" rel="nofollow">The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)</a> manages to live up to its title pretty well.</p>

python unicode