CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1

    Converting UTF-8 Strings to Unicode.

    Hi Guys

    I am very new to UTF8.

    I am debugging a code wherein the UTF8 string is converted into Wide char by using

    BSTR unicodestr = SysAllocStringLen(NULL, bufferLen);
    ::MultiByteToWideChar(CP_UTF8, 0, tmpBuffer, -1, unicodestr, bufferLen);

    Where tmpBuffer is
    char *tmpBuffer and has the value "ÜBERSETZEN1" //German

    However after MultiByteToWideChar is called the unicodestr has the value
    BERSETZEN1 thereby losing the first German character.

    I have written some sample code and the behavior is consistent as above.

    I am pretty sure i am missing something. Is there a way i can convert it to unicode so that i am able to retain the whole string?

    Thanks for your help.

    Kandukondein
    Last edited by kandukondein; March 15th, 2011 at 05:55 AM.
    C++ is divine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured