From the course: C Programming: Exploring Advanced Concepts and Practical Applications
Unlock the full course today
Join today to access over 23,400 courses taught by industry experts.
Understanding Unicode and wide characters
From the course: C Programming: Exploring Advanced Concepts and Practical Applications
Understanding Unicode and wide characters
- [Trainer] To provide consistency between computer platforms and to share data, the ASCII Standard defines 128 character codes. These codes fit neatly into a byte, the C language character data type, which can hold values up to 256 or 255 when you start at zero. But the ASCII character set is rather limited, therefore, a newer, broader standard was developed. This new standard is called Unicode. It defines thousands of character codes, over 140,000 at last count. To do so, Unicode expresses character values in a size greater than a single byte. In C, these multi byte characters are referred to as wide characters. To work with wide characters, your C program must first set the locale for the character type. Next, you use wide character functions, which means including the wchar.h header file. This header file defines the wchar_t data type, which holds wide character values and is used by various wide character versions of standard C I/O functions. It also helps to know the wide…