views:

108

answers:

1

I heard fopen supports UTF8 but i dont know how to convert an array of shorts to utf8

How do i create a file with unicode letters in it? I prefer to use only built in libraries (no boost which is not installed on the linux box). I do need to use fopen but its pretty simple to.

+6  A: 

fopen(3) supports any valid byte sequence; the encoding is unimportant. Use nl_langinfo(3) with CODESET to get what charset you should use for the encoding, and libiconv or icu for the actual encoding.

Ignacio Vazquez-Abrams
+1, but you forget the need to call setlocale so that nl_langinfo(3) returns the correct result.
AProgrammer