cpprestsdk icon indicating copy to clipboard operation
cpprestsdk copied to clipboard

I was facing a string conversion problem.

Open kanggwangmo opened this issue 3 years ago • 2 comments

I'm having a problem with the code below. How can I resolve this?

CString strResult = jsonDocs[U("name")].as_string().c_str(); // strResult = �߿乮��

kanggwangmo avatar Nov 07 '22 05:11 kanggwangmo

char* on windows is usually interpreted as the active system codepage. Try something like this to use utf-8 in a windows app with the various platform APIs.

barcharcraz avatar Nov 16 '22 21:11 barcharcraz

I have set visual studio 2015 my page settings (advanced save options) to Unicode (UTF-8 with signature, codepage 65001).

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage entry in the registry was set to 949, but changed to 65001.

The region is Korea.

Development language: MFC

kanggwangmo avatar Nov 17 '22 01:11 kanggwangmo