php和希腊字符

时间:2012-06-30 21:45:25

标签: php utf-8

我有这个脚本从HTML表单中获取Fname。当我插入希腊字符时,文件夹的名称在Windows资源管理器中显示符号。为什么会发生这种情况,我该怎么做才能解决这个问题?

$folderStr = $_REQUEST['FName'];

//create SEO firndly directory name
$upload_folder =    preg_replace ("'\s+'", '-', $folderStr);

// The place the files will be uploaded to (currently a 'files' directory).
 $upload_path = './uploads/'.$upload_folder.'/';

//Check whether folder exists or create with the name supplied

if(is_dir($upload_path))
echo 'directory exists';
else
mkdir ('./uploads/'.$upload_folder.'/', 777);

1 个答案:

答案 0 :(得分:1)

确保您提交的表单是utf-8编码的。

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />