C++ http read special characters from my SQL DB -
when perform post call c++ client fetching mysql data (i use classical webservice), got troubles when special characters in http result, eg "è", "à", "ò"... in fact, store server answer (the http result) in char* variable can read "è" instead of "è". post:
httpobject->setrequestheader("content-type", "application/x-www-form-urlencoded"); httpobject->setrequestheader("cache-control", "max-age=0"); httpobject->setrequestheader("accept", "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"); httpobject->setrequestheader("accept-encoding", "gzip,deflate,sdch"); httpobject->setrequestheader("accept-language", "it-it"); httpobject->setrequestheader("accept-charset", "iso-8859-1,utf-8;q=0.7,*;q=0.3"); httpobject->post(my_webservice, my_text, text_length, callback_gotheaders, null);
and return:
char buf[http_buffer]; snprintf(buf, http_buffer, http_result);
i tried type of experiment: wrote whole string result wish in .txt file. put file on server , fetch using get, read text c++ client. in case, rightly read characters without problems. so, suppose, there strange in sql result, i'm not able fix it. there should in charset used client , sql db.
the strings saved on db nvarchar. client use utf-8 encoding.
Comments
Post a Comment