내가 자꾸 까먹어서 쓰는 개발 이야기/PHP
nusoap_client 이용 시 한글이 깨질 때
FIL.
2019. 12. 19. 11:23
728x90
흔하진 않지만 nusoap을 이용하는 API들을 사용해야 할때가 있다.
설정이 맞지 않으면 한글이 "???" 와 같이 표시된다.
아래와 같이 설정하면 정상적으로 표시 된다.
$client = new nusoap_client(/*ENDPOINT*/);
$client->decode_utf8 = FALSE;
$client->soap_defencoding = "UTF-8";
$client->setHeaders("Content-Type: text/xml;charset=UTF-8");
출처: https://stackoverflow.com/questions/20887830/return-utf-8-farsi-string-from-nusoap-webservice