# Programming Ruby 3.3 (5th Edition, p 122): Unicode Character Definition Incorrect

**URL:** <https://forum.devtalk.com/t/programming-ruby-3-3-5th-edition-p-122-unicode-character-definition-incorrect/138561>\
**Category:** PragProg Customers\
**Tags:** errata, book-programming-ruby-3-2-5th-edition\
**Created:** [6 January 2024 20:36 UTC](https://forum.devtalk.com/t/programming-ruby-3-3-5th-edition-p-122-unicode-character-definition-incorrect/138561 "2024-01-06T20:36:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stmpjmpr](https://forum.devtalk.com/user_avatar/forum.devtalk.com/stmpjmpr/32/5831_2.png) [@stmpjmpr](https://forum.devtalk.com/u/stmpjmpr)\
**Post date:** [6 January 2024 20:36 UTC](https://forum.devtalk.com/t/programming-ruby-3-3-5th-edition-p-122-unicode-character-definition-incorrect/138561/1 "2024-01-06T20:36:29Z")

</div>

@noelrappin

On page 122, in the discussion of “Strings and Encodings”, it is stated: “A Unicode character is two bytes long, which makes a Unicode string twice as long internally as a Latin-1 string.” This is incorrect. Unicode represents a 21-bit code space; two bytes are not enough to cover it.

The Unicode Standard says, "Unicode characters are represented in one of three encoding forms: a 32-bit form (UTF-32), a 16-bit form (UTF-16), and an 8-bit form (UTF-8). The 8-bit, byte-oriented form, UTF-8, has been designed for ease of use with existing ASCII-based systems. "

I’d further argue that this is not just being pedantic: the idea that Unicode can be captured completely in two bytes is one of the more dangerous lingering misconceptions. It leads people to think that UTF-16, for instance, will always be 2-byte units (it is, like UTF-8, a variable-length encoding).
