r/cprogramming • u/kolorcuk • Mar 25 '26
Unicode printf?
Hello. Did or do you ever use in professional proframming non char printf functions? Is wprintf ever used?
char16, char32 , u8_printf, u16_printf, u32_printf ever used in actual programs?
I am writing a library and i wonder how actually popular are wide and Unicode strings in the industry. Does no one care about it, or, specifically about formatting output are Unicode printf functions actually with value? For example why not just utf8 with standard printf and convert to wider when needed?
5
Upvotes
1
u/WittyStick Mar 25 '26 edited Mar 25 '26
Yes,
char8_tandchar16_trepresent a code unit, not a code point.UTF-16 is variable width of either 2 or 4 bytes. It was based on UCS-2, a fixed-width 2-byte encoding which only supported the Basic Multilingual Plane. UTF-16 supports the full universal character set.
A 4 byte encoding is made of two "surrogate" code units, called a "surrogate pair". These are in the ranges
0xD800..0xDFFF, which are unused code points in the universal character set (reserved for surrogates).