liveBook · Manning

Unicode

As explained in Modern C

Unicode is an international character standard that assigns code points and properties to a unified repertoire of characters.

A printed A does not uniquely identify a character. “Latin capital letter A” can have different printed forms, while “Greek capital letter Alpha” can look similar. Unicode, also called ISO 10646 here, identifies character concepts as code points rather than treating glyphs as identities. It also records properties and relationships, such as whether a character is a capital letter. section 14.3

43   #define VBAR "\u2502"      /**< a vertical bar character   */
44   #define HBAR "\u2500"      /**< a horizontal bar character */
45   #define TOPLEFT "\u250c"   /**< topleft corner character   */
46   #define TOPRIGHT "\u2510"  /**< topright corner character  */


!@%STYLE%@!
{"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":0,\"ch\":0},{\"line\":0,\"ch\":2}],[{\"line\":0,\"ch\":5},{\"line\":0,\"ch\":12}],[{\"line\":1,\"ch\":5},{\"line\":1,\"ch\":12}],[{\"line\":2,\"ch\":5},{\"line\":2,\"ch\":12}],[{\"line\":3,\"ch\":5},{\"line\":3,\"ch\":12}],[{\"line\":1,\"ch\":0},{\"line\":1,\"ch\":2}],[{\"line\":0,\"ch\":5},{\"line\":0,\"ch\":12}],[{\"line\":1,\"ch\":5},{\"line\":1,\"ch\":12}],[{\"line\":2,\"ch\":5},{\"line\":2,\"ch\":12}],[{\"line\":3,\"ch\":5},{\"line\":3,\"ch\":12}],[{\"line\":2,\"ch\":0},{\"line\":2,\"ch\":2}],[{\"line\":0,\"ch\":5},{\"line\":0,\"ch\":12}],[{\"line\":1,\"ch\":5},{\"line\":1,\"ch\":12}],[{\"line\":2,\"ch\":5},{\"line\":2,\"ch\":12}],[{\"line\":3,\"ch\":5},{\"line\":3,\"ch\":12}],[{\"line\":3,\"ch\":0},{\"line\":3,\"ch\":2}],[{\"line\":0,\"ch\":5},{\"line\":0,\"ch\":12}],[{\"line\":1,\"ch\":5},{\"line\":1,\"ch\":12}],[{\"line\":2,\"ch\":5},{\"line\":2,\"ch\":12}],[{\"line\":3,\"ch\":5},{\"line\":3,\"ch\":12}]]"}
!@%STYLE%@!

These C string macros use Unicode escapes for horizontal and vertical lines and box corners. The escapes identify characters without requiring those characters on the keyboard. section 14.3

TAKEAWAY: A code point identifies a character concept, not its printed shape or the bytes used to represent it. C programs handling such characters as multibyte strings may need a locale for printing and an mbstate_t parsing state when scanning them. section 14.3

How Modern C covers it

How deep it goes
Defines code points through a glyph distinction and describes properties, without detailing Unicode’s assignment rules.
Examples
Uses Latin A and Greek Alpha to distinguish characters from glyphs, and box-drawing escapes in C macros.
What it assumes
Assumes familiarity with C strings while defining code points through concrete character examples.
What you can do after
Apply it via C Unicode escapes to name special characters in string literals.
How it connects
Connects Unicode to ISO 10646, glyphs, multibyte strings, locales, wchar_t and mbstate_t.

Also explained in

Compare how 8 books explain Unicode →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Modern C. The section links point to the parts of the book it draws on.