Posted
Filed under asp,asp.net

[원문] : http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=7&MAEULNo=5&no=61939&ref=61382


snuoap.php의 parseResponse function 에서

아래와 같이 $this->xml_encoding setting하는 부분을 모두 주석처리하고,

항상 'ISO-8859-1'로 되도록 수정했습니다.

/*
if (strpos($headers['content-type'], '=')) {

$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));

$this->debug('Got response encoding: ' . $enc);

if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){

$this->xml_encoding = strtoupper($enc);

} else {

$this->xml_encoding = 'US-ASCII';

}

} else {

// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1

$this->xml_encoding = 'ISO-8859-1';

}

*/

$this->xml_encoding = 'ISO-8859-1';

그리고 .NET으로 만든 웹서비스에서 return되어 온 값은

php의 iconv함수를 이용해서 아래와같이 변환을 하니

한글이 제대로 처리되었습니다.

iconv("UTF-8", "EUC-KR", 리턴값);

혹, 저처럼 php에서 nusoap.php를 이용해서 .NET 으로 개발된 웹서비스와 연동을 할 경우가

생기는 분이 계실까봐 자문 자답을 올립니다.

2012/08/29 20:01 2012/08/29 20:01