Saving php Arabic file on Windows 7

In php and windows7, like OS file saving as arabic name, it gives like this ... ร˜'ร˜ ยฑ ร˜ '' โ€ฐ ร˜ยบร˜ '. I need to store the filename with only Arabic text.

header("Content-Type:text/html;  charset=utf-8"); 
$name = $_GET['name'];
if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] )) 
{
$filename = $name.".png";
file_put_contents($filename,$GLOBALS[ 'HTTP_RAW_POST_DATA' ]);
}

      

Please help me.

Thank.

+3


source to share


1 answer


Try the following:



header("Content-Type:text/html;  charset=utf-8"); 
$name = $_GET['name'];
if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] )) 
{
  $encoding = mb_detect_encoding($name);
  $filename = iconv($encoding, "UTF-8", $name.".png");
  file_put_contents($filename,$GLOBALS[ 'HTTP_RAW_POST_DATA' ]);
}

      

+4


source







All Articles