I need to send and string over internet from a Windows [client side] system to a UNIX [server side] ...
In the client side I have a std::wstring data and I "translate" this data to an UTF-8 std::string before send it to avoid problems in server side. To do that, I´m using WideCharToMultiByte func Content not found.
However, I´m facing a problem to send "Skype ™ 4.2.2". The following error is launched in server side:
"... a wide character has been encountered that can not be represented as a multibyte sequence (according to the current locale) [Skypeâ
¢ 4.1] : [Invalid or incomplete multibyte or wide cha ..."
I wrote a sample code to illustrate what I´m trying to do:
std::wstring wide = L"Skype ™ 4.2.2";
std::string normal = "";
if (WideCharToMultiByte(CP_UTF8, 0, wide.c_str(), -1, codePgBuf, sizeof(codePgBuf), NULL, NULL) == 0)
printf("WC2MB failed for %u : '%S", GetLastError(), wide.c_str());
normal = codePgBuf;
pFile = fopen("test.txt", "w");
The result of this program is an file [test.txt] with this content:
Skype â„¢ 4.2.2
WTF is going on? What am I doing wrong? Any guess?
Is it possible to use WideCharToMultiByte with Letterlike Symbols?