core icon indicating copy to clipboard operation
core copied to clipboard

PHP + can`t find/open files with special characters

Open AnthonyAoun1 opened this issue 10 years ago • 2 comments

I have a PHP script that uploads docs manually to moodle This script doesn't work with documents containing any special character (like Arabic) in the file name mb_detect_encoding($filename) is returning utf8 I tried to echo iconv('cp1256', 'UTF-8', $file);
utf8_decode($file); iconv('UTF-8', 'ISO-8859-1', $file); mb_convert_encoding($file, 'ISO-8859-1', 'UTF-8'); iconv('UTF-8', 'UTF-8', $file); // $file = iconv('WINDOWS-1256', 'UTF-8', $file); // echo "1 == ". iconv( "windows-874","utf-8" , $file ); // echo "2 == ". iconv("unicode", "utf-8", $file); // echo "3 == ". iconv("Latin1_General_CI_AS","utf-8",$file); // echo "4 == ". iconv("Arabic_CI_AS","utf-8",$file); // echo "5 == ".iconv('WINDOWS-1256', 'UTF-8', $file); // echo "6 == ". iconv( "Windows-1252","utf-8" , $file ); // echo "6 == ".iconv('cp1256', 'UTF-8', $file); // echo "7 == ".iconv('iso-8859-1', 'UTF-8', $file); // echo "8 == ". base64_encode($file); // echo "9 == ". utf8_encode($file);
// echo "10 == ". base64_decode($file);
// echo "11 == ". utf8_decode($file);
// $file = utf8_encode($utf8_string); // $file = utf8_decode($file);

I can't get the file to output as Arabic text, the target is to get file_exists($filename) return true.

I am using Windows Server 2012 R2 Standard and I am running the script from cmd

AnthonyAoun1 avatar Jan 11 '16 08:01 AnthonyAoun1

@AnthonyAoun1 This is the issue tracker of ownCloud, not moodle. :-)

ghost avatar Jan 11 '16 08:01 ghost

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Aug 07 '19 01:08 lock[bot]