Endianness

The byte order of multi-byte data. Two types exist: big-endian and little-endian.

Endianness refers to the byte order when storing multi-byte data in memory or files. Big-endian (BE) stores the most significant byte first, while little-endian (LE) stores the least significant byte first.

In UTF-16 encoding, endianness differences can cause character corruption. Placing a BOM (Byte Order Mark, U+FEFF) at the beginning of a file explicitly indicates the endianness. Computer architecture books cover this topic in detail.

x86/x64 processors use little-endian, network protocols (TCP/IP) use big-endian, and ARM processors are bi-endian (supporting both).

For character counting, endianness affects byte representation but not character count itself. However, byte counting must consider endianness. Low-level programming books provide additional context.