많은 언어를 지원하는 C 프로그램을 만들고 있습니다. 이 프로그램은 char 대신 WCHAR 유형을 사용하여 전자 메일을 보냅니다.유니 코드 문자가 올바르게 표시되지 않습니다.
<!-- language: lang-c -->
curl_easy_setopt(hnd, CURLOPT_READFUNCTION, payload_source);
curl_easy_setopt(hnd, CURLOPT_READDATA, &upload_ctx);
static const WCHAR *payload_text[]={
L"To: <[email protected]>\n",
L"From: <[email protected]>(Example User)\n",
L"Subject: Hello!\n",
L"\n",
L"Message sent\n",
NULL
};
struct upload_status {
int lines_read;
};
static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp){
struct upload_status *upload_ctx = (struct upload_status *)userp;
const WCHAR *data;
if ((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
return 0;
}
data = payload_text[upload_ctx->lines_read];
if (data) {
size_t len = wcslen(data);
memcpy(ptr, data, len);
upload_ctx->lines_read ++;
return len;
}
return 0;
}
당신이 어떤 환경과 컴파일러를 사용 했습니까? – AlexLordThorsen
또한 전자와 m은 어떻게 생겼습니까? 그들은 정상적인 성격보다 약간 강조점이 있습니까? – AlexLordThorsen