Lex Syntax <> wrote:
> I wanted to write a unicode character, e.g \u1200, to a text file.
> Tried this but doesn't work:
What do you mean "it doesn't work"? What is it exactly that you want to
do. "Write a unicode character to a file" is not enough description to
know what is it that you want.
Unicode defines numerical values for characters. It doesn't define how
those values are stored. There are ancillary standards that define how
those values should be stored. Several ones. Most typical examples include
the UTF-8 and the UTF-16 formats. (In theory you could also store them
raw, which I suppose would be something akin to UTF-32, but even then
you have the problem of specifying endianess.)
If you want to store the unicode character eg. in UTF-8 format, you
have to convert it. There's (currently) no functionality in standard C++
to do this conversion, but you can use a third-party library such as
http://utfcpp.sourceforge.net/