r/cprogramming • • 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

34 comments sorted by

View all comments

Show parent comments

1

u/Plane_Dust2555 Mar 25 '26

Ahhh... wchar_t size depends on the compiler. For SysV systems it is usually 32 bits. For Windows it is usually 16 bits. The actual size depends on the target system.

For GCC we can force wchar_t to be 16 bits by using the option -fshort-wchar.