2012-06-06 5 views
0

나는 외부 프로그램을 shell_exec을 통해 호출하는 PHP 스크립트를 사용하고 있으며 출력에 관심이 있습니다. 문제는 러시아 문자를 사용할 때 항상 출력이 물음표로 표시된다는 것입니다.PHP shell_exec는 물음표를 출력합니다

우분투 11.10에서 모든 일이 runnnig입니다. 외부 프로그램이 bash에서 실행되면 올바른 출력 (물음표 없음)이 나타납니다. 'LANG="en_US.UTF8" mono %sengine/helpers/language/morpher.exe %s';

:과 같이 LANG="en_US.UTF8"을 추가하여
setlocale(LC_ALL, "en_US.UTF-8"); 
echo morpher("Антон"); 

function morpher($command) { 
    static $path = '/usr/bin/mono %sengine/helpers/language/morpher.exe %s'; 
    $path = sprintf($path, SITE_ROOT, $command); 

    $output = shell_exec($path); 

    error_log($output) // series of question marks instead of russian letters 
    error_log(mb_detect_encoding($output)); // outputs ASCII 
    error_log(iconv('ASCII', 'UTF-8', $output)); // same question marks 

    return explode("\n", $output); 
} 

답변

0

가 해결 : 여기

내가 가진 그 코드의
관련 문제