Linux & C-Programming: How can I write utf-8 encoded text to a file?
问题 I am interested in writing utf-8 encoded strings to a file. I did this with low level functions open() and write(). In the first place I set the locale to a utf-8 aware character set with setlocale("LC_ALL", "de_DE.utf8") . But the resulting file does not contain utf-8 characters, only iso8859 encoded umlauts. What am I doing wrong? Addendum: I don't know if my strings are really utf-8 encoded in the first place. I just keep them in the source file in this form: char *msg = "Rote Grütze"; See