I made some modifications on the code you posted, I assumed that your web page uses utf-8:
Test web application:
from bottle import *
content_type = 'text/html; charset=utf-8'
@route("/ar/")
def ar():
response.content_type = content_type
return "تجربة"
@route("/en/")
def en():
response.content_type = content_type
return "Test"
@route("/zn/")
def zn():
response.content_type = content_type
return "测试"
run(port=8080)
The code:
#include <windows.h>
#include <wininet.h>
#pragma comment(lib, "wininet.lib")
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
HINTERNET hInternet = InternetOpen(TEXT("foo"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
HINTERNET hConnect = InternetConnect(hInternet, TEXT("http://localhost:8080/"), INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 1);
DWORD options = INTERNET_OPTION_HTTP_DECODING | INTERNET_FLAG_NEED_FILE | INTERNET_FLAG_HYPERLINK | INTERNET_FLAG_RESYNCHRONIZE | INTERNET_FLAG_RELOAD;
HINTERNET hRequest = InternetOpenUrl(hInternet, TEXT("http://localhost:8080/ar/"), NULL, 0, options, 0);
BYTE buffer[100] = {0};
TCHAR szResp[100] = {0};
DWORD bytesRead;
InternetReadFile(hRequest, &buffer[0], sizeof(buffer) - 1, &bytesRead);
MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, (LPCSTR) &buffer[0], sizeof(buffer), &szResp[0], sizeof(szResp));
MessageBox(NULL, &szResp[0], TEXT("Check"), MB_OK);
InternetCloseHandle(hRequest);
InternetCloseHandle(hConnect);
return 0;
}
Note, make sure you handle the errors.