locked
Mixed character (English and Japanese) strings are not UTF-8 encoded correctly on Japanese OS by windows API - WideCharToMultiByte RRS feed

  • Question

  • Hi,

    I have a Windows (MFC) application that passes a mixed character (English and Japanese) string like "Templete_DRAFT-4_final_コメン– Notepad"to a website using Request(CHttpConnection::HTTP_VERB_POST, remoteFileCopy, NULL, 1, NULL, _T("HTTP/1.1"), INTERNET_FLAG_DONT_CACHE | ((dwServiceType == AFX_INET_SERVICE_HTTPS) ? INTERNET_FLAG_SECURE : 0))).

    Earlier the Japanese characters were displayed as ?(questions marks) but then I used windows API " WideCharToMultiByte(CP_UTF8,0,m_sDocName, -1, buf, sizeof(buf),NULL,NULL); " to encode it to UTF-8. And It works well with English OS but on Japanese OS the encoding is not accurate. The text is coming @ web site as "Templete_DRAFT-4_final_

    コメンチE20- メモ帳"

    would someone advise me to get a solution at the earliest.

    Thanks

    which is not the same. I tried all possible flags with API --- WideCharToMultiByte, but no hope yet.

    Thursday, November 15, 2012 10:33 AM

Answers

  • Hi Rajesh -- I think this is probably the wrong place to post the question -- here we deal with the translator API, which is used for machine translation between languages.

    I'd suggest looking at the C++/MFC forums: http://social.msdn.microsoft.com/Forums/en-US/vcmfcatl/threads
    Thursday, November 15, 2012 9:21 PM

All replies

  • Hi Rajesh -- I think this is probably the wrong place to post the question -- here we deal with the translator API, which is used for machine translation between languages.

    I'd suggest looking at the C++/MFC forums: http://social.msdn.microsoft.com/Forums/en-US/vcmfcatl/threads
    Thursday, November 15, 2012 9:21 PM
  • Laurence,

    Thanks a lot for the heads up. I posted @ the C++/MFC area.

    Have a good day.

    Thanks

    Rajesh

                    

    sdas

    Friday, November 16, 2012 8:52 AM
  • Rajesh,

    Did you find an answer for your question?

    Since its a pretty old post so i am not sure if you remember this or not but i am facing similar kind-of problem with Chinese + English characters on Chinese OS.

    Your suggestion can be really helpful.

    I have posted similar question on https://social.msdn.microsoft.com/Forums/en-US/4faf0252-d493-413c-89c3-b8d479161275/problem-with-widechartomultibyte-on-chinese-os?forum=translatorhub

    Tuesday, March 31, 2015 2:27 PM