How to set the locale::global to utf8 encoding?



Hi,

I try to set the global locale to "utf8" to let the mbstowcs()
function works for convert a utf8 string to an wchar_t*. I tried the
following code:

std::locale loc(".65001");
std::locale::global(loc);

But I failed at the first line, which I try to create a locale object
which code page is 65001(utf8). When I looked into the VC STL code, I
found in the implementation, there is a line to determine whether I
try to use UTF8 or UTF7, if I do, the function will return without
doing anything useful.

What is the problem? Can I set locale::global() to UTF8?

Thanks.

.



Relevant Pages

  • Re: utf8 -> ascii in c language??
    ... > read line from utf8 string i can't get any thing! ... > maybe i should conversion utf8 to ascii??there is any function can ... I would recommend writing the bytes of each string out as a number and ...
    (comp.lang.c)
  • module OpenOffice::OODoc fails with Unicode characters
    ... When I try to write out a utf8 string using extendText(), appendParagraph or other methods with the OpenOffice::OODoc module, I get the following error: ... I have the localEncoding set to utf8 as I should and it reads in fine from an office document containing utf8 characters. ...
    (comp.lang.perl.misc)
  • utf8 -> ascii in c language??
    ... read line from utf8 string i can't get any thing! ... maybe i should conversion utf8 to ascii??there is any function can ... conversion utf8 to ascii? ...
    (comp.lang.c)
  • utf8 -> ascii in c language??
    ... read line from utf8 string i can't get any thing! ... maybe i should conversion utf8 to ascii??there is any function can ... conversion utf8 to ascii? ...
    (comp.os.linux.misc)