microsoft / cpprestsdk

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
7.91k stars 1.64k forks source link

I was facing a string conversion problem. #1731

Open kanggwangmo opened 1 year ago

kanggwangmo commented 1 year ago

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

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

barcharcraz commented 1 year ago

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.

kanggwangmo commented 1 year ago

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