GuzzleHTTP 6.0을 사용하여 API 서버에서 데이터를 가져옵니다. 어떤 이유로 API 서버가 수신 한 요청이 UTF-8로 끝나는 것이 아니며 ü,ö,ä,ß
문자가 깨져서 표시됩니다.GuzzleHttp 요청이 깨진 문자를 전송합니다.
내 기본 시스템 및 데이터베이스는 UTF-8
입니다.
는 난이 출력 인 RequestOptions
에 true
에 debug
을 설정
User-Agent: GuzzleHttp/6.2.1 curl/7.47.0 PHP/7.0.22-0ubunut0.16.04.1 Content-type: text/xml;charset="UTF-8" Accept: text/xml" Cache-Control: no-cache Content-Length: 2175 * upload completely sent off: 2175 out of 2175 bytes <HTTP/1.1 200 OK <Server:Apache:Coyote/1.1 <Content-Type: text/xml; charset=utf-8 <Transfer-Encoding: chunked <Date: Thu, 23 Nov 2017 9:34:12 GMT <* Connection #5 to host www.abcdef.com left intact
I가 explicitily UTF-8 헤더 내용을 설정;
$headers = array(
'Content-type' => 'text/xml;charset="utf-8"',
'Accept' => 'text/xml',
'Content-length' => strlen($requestBody),
);
는 또한 mb_detect_encoding()
방법 내가이 문제를 디버깅 어떻게
mb_detect_encoding($requestBody,'UTF-8',true); // returns UTF-8
더 이상의 아이디어를 사용하여 테스트하려 .. ??