J
Jon Willeke
This feels like a FAQ, but I've been unable to find a satisfactory
answer. Given a Unicode encoding (such as UCS-4) in wchar_t, I want to
convert to UTF-8 (or another locale-specific encoding) in a manner not
entirely unlike the following:
wstring w = L"H\xe9llo";
locale loc( "en_US.UTF-8" );
wcout.imbue( loc );
wcout << w << endl;
I've tried Visual C++ 6.0 and Borland C++ 5.6.4 on Windows, as well as
GCC 3.3.1 on Linux. They don't seem to do anything approximately like
this. I tried plugging in a hand-written codecvt subclass, but it
doesn't seem to be used.
answer. Given a Unicode encoding (such as UCS-4) in wchar_t, I want to
convert to UTF-8 (or another locale-specific encoding) in a manner not
entirely unlike the following:
wstring w = L"H\xe9llo";
locale loc( "en_US.UTF-8" );
wcout.imbue( loc );
wcout << w << endl;
I've tried Visual C++ 6.0 and Borland C++ 5.6.4 on Windows, as well as
GCC 3.3.1 on Linux. They don't seem to do anything approximately like
this. I tried plugging in a hand-written codecvt subclass, but it
doesn't seem to be used.