问题
i have a file containing UTF-16 characters. i read in the file and can store the characters either in a uint16_t array or a char array (any better choice?)
But how do i print those characters?
回答1:
I'm assuming you want to print to stdout
or stderr
. One method would be to use libiconv to convert from UTF-16 to UTF-32 (also known as UCS-4) into a wide-character string (wchar_t
). You could then use wprintf
and friends to print to the standard streams.
来源:https://stackoverflow.com/questions/8315686/how-to-print-utf-16-characters-in-c