How to print UTF-16 characters in C?

I have a file containing UTF-16 characters. I read in a file and can store characters either in the uint16_t array or in the char array (any better choice?)

But how can I print these characters?

+4
source share
1 answer

I assume you want to print to stdout or stderr . One method is to use libiconv to convert from UTF-16 to UTF-32 (also known as UCS-4) character string ( wchar_t ). Then you can use wprintf and friends to print to standard streams.

+4
source

Source: https://habr.com/ru/post/1383700/


All Articles