저는 CodeIgniter가있는 다국어 사이트에서 작업하고 있습니다. 이 게시물 데이터가 컨트롤러에있는 형식입니다,하지만 난에 문자 집합을 설정
öçüÜĞ
등처럼 터키어 문자를 사용하기 시작할 때 $_POST
이 비어 :
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
형태 :
<form action="translations/save" method="post" accept-charset="utf-8">
<textarea rows="6" cols="60" id="editor_tr" name="editor_tr">Türkçe</textarea>
</form>
$_POST
및 $this->input->post('editor_tr')
은 빈 상태로 반환되지만 file_get_contents("php://input")
인 원시 게시물을 볼 수 있습니다.
이 코드는 일반적인 PHP 테스트에서는 정상적으로 작동하지만 CodeIgniter에서는 작동하지 않습니다. 아마도 .htaccess 파일이 문제를 일으키는 것일 수도 있지만 몰라요.
도움을 주시면 감사하겠습니다.
업데이트 : 다음은 요청한대로 var_dump에 대한 출력입니다.
var_dump($_POST)
- 터키 문자
array(3) { ["id"]=> string(12) "news8titleID" ["editor_tr"]=> string(13) "turkish value" ["editor_en"]=> string(13) "english value" }
var_dump($_POST)
Türkçe karakter
하지만이 $ _POST에 표시되지 않음)
array(3) { ["id"]=> string(12) "news8titleID" ["editor_tr"]=> string(0) "" ["editor_en"]=> string(13) "english value" }
업데이트 2 : 디버깅 할 때 _clean_input_data
함수의 입력 데이터를 system.core.Input
클래스가 지우는 것을 발견했습니다. $_POST
내 컨트롤러에 도달하기 전에
// Clean UTF-8 if supported
if (UTF8_ENABLED === TRUE)
{
$str = $this->uni->clean_string($str);
}
따라서는 editor_tr
값은 이미이 기능에 system.core.Utf8
클래스에 의해 청소 :이 답변을 밤은
function clean_string($str)
{
if ($this->_is_ascii($str) === FALSE)
{
$str = @iconv('UTF-8', 'UTF-8//IGNORE', $str);
}
return $str;
}
mbstring을 사용해 보셨습니까? [codeigniter]에 대한 관련 픽스 (http://www.haughin.com/2010/02/23/building-utf8-compatible-codeigniter-applications/) –
'내 .htaccess 파일이 문제의 원인 일 수 있지만 몰라요. 그런 다음 그것을 공급하는 것을 고려해야합니까? – Khez
@Madmartigan 죄송합니다. 오타였습니다. – Ozay