3
Google의 Translate API와 함께 아래 PHP 코드를 사용하고 있으며 json_encode
에 UTF-8 입력이 필요하다는 것을 읽었으므로 Google에서 UTF-8 인코딩 된 문자를 반환하는지 어떻게 알 수 있는지 궁금합니다. ? json_decode
이 실패 할 경우Google 번역 API 및 문자 인코딩
// URL Encode string
$str = urlencode($str);
// Make request
$response = file_get_contents('https://www.googleapis.com/language/translate/v2?key=' . GTRAN_KEY . '&target=es&source=en&q=' . $str);
// Decode json response to array
$json = json_decode($response,true);
대단히 감사합니다. – Brett