Character encoding

Oct 8, 2014 at 8:16 PM
Edited Oct 10, 2014 at 6:09 PM

I'm using pstsdk into xcode for Mac and I'm facing problem with encoding while retrieving the folder names.
For exemple if the folder name is: "Réception" the following code gives me: r\303ception

const std::wstring sCpp = iter->get_name();
std::wcout << sCpp;

Same issue with all é è à ..... which all give \303

What I'm doing wrong??

Thank you for your help

Nov 2, 2014 at 10:25 AM

No answer and no solution yet. Please help me.
Dec 11, 2014 at 9:00 AM

You need to convert its locale beforehand. Example:
std::wostringstream ss;
std::locale const utf8_locale(std::locale(), new std::codecvt_utf8<wchar_t>());

ss << msg.get_body();

std::wstring s = ss.str();
You may need to use a different specialization of codecvt, UTF-16 for instance.
Try outputting to a file first, because outputting to the console may require additional steps.

Dec 11, 2014 at 9:04 AM
Edited Dec 11, 2014 at 9:05 AM

Posted link because if not converting, you'll almost certainly get a character code that will break the stream output at some point.