質問

I read a german text from an sqlite database with C++, (the text looks good with the database viewer). But when I display it in a dialog with SetDlgItemText the text looks like this (see the picture).

enter image description here

    CString strWarning(pStmt->GetColumnCString(nCol));      
    SetDlgItemText(IDC_WARNING_MESSAGE, strWarning);
役に立ちましたか?

解決

Your string looks like it's encoded as UTF-8, which Windows doesn't handle.

You'll need to convert it to UTF-16 and ensure that you're calling the wide version of SetDlgItemText, either by changing your project's character set option to Use Unicode Character Set or specifying SetDlgItemTextW.

You can convert your string from UTF-8 to UTF-16 with the MultiByteToWideChar function.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top