Win32 API multilanguage conversion WCHAR,TCHAR problem?
I am using recv() func for "GET"ting a web content on port80. And try printing the received content on an Edit Controlon screen, by using ::SendMessage(...WM_SETTEXT...)
Due to the limitations of pointer types to be compliant to the func presets, I have to make some conversion.
Everything works fine, with latin letters but I can not anyhow manage to output the foreign language characters properly. Let's say russian.
How can I do this?Do I need to somehow change the edit control's character set, so as to interpret the passed string buffer as I wish? If so, how?I'll appreciate your help.
Here I enclose a short abstract from my code (as u might see I enforce UNICODE compilation)
#define RECBUFF 100000
bool KNetCon::WriteToScr(HWND hEditCtl)
// ----clear screen in edit
char *sendbuf="GET / HTTP/1.0 \r\n\r\n";
TCHAR* temp=wrecbuf; //*** NOTE: wrecbuf is the main buffer in (this)object.
// and declared in the class interface as ; TCHAR wrecbuf[RECBUFF]
//***recbuf declared in class interface as:
// char recbuf[RECBUFF] in
if(bytes_received==0 || bytes_received==WSAECONNRESET || bytes_received < 0)
*temp=L'\0';// **I am not sure if this is necessary or not,but
// the intention is form a null-terminating string.
mbstowcs(temp,recbuf,bytes_received); // I think this it the vital part..right???
// maybe smthg wrong here?
Last edited by Marc G; November 30th, 2010 at 02:55 AM.
Reason: Added code tags