2013-03-02 93 views
2

我在CentOS服務器上安裝了PHP,並且我想將此文件(使用PHP FTP)傳輸到運行IIS的Windows FTP服務器。現在我的問題是,當文件名有非拉丁字符時,它將文件名更改爲'تست.3gp'(它在CentOS中的名字是تست.3 gp)。我搜索了很多次,但沒有解決方案。我怎樣才能解決這個問題?複製的文件名變成亂碼

我認爲Windows使用CP-1252(Windows-1252)作爲字符集,而CentOS使用UTF-8作爲字符集。但將其與iconv()mb_convert_encoding()轉換不起作用。

+1

看到這網頁我回答了這個問題http://stackoverflow.com/questions/15055192/why-does-windows-need-to-utf8-decode-filenames-for-file-get-contents-to-work/15055869#15055869 – 2013-03-02 16:43:42

+0

它不起作用 – IVIR3zaM 2013-03-02 18:00:06

+0

它對我來說工作正常問題? – 2013-03-02 18:02:32

回答

0

我們也可以在mb_convert_encoding()使用這些值編碼:

// Cyrillic script such as Russian, Bulgarian, Serbian Cyrillic and other languages Windows-1251 ~= ISO-8859-5 

// Latin alphabet Windows-1252 ~= ISO-8859-1 // sometimes called incorrectly "ANSI" 

//modern Greek. It is not capable of supporting the older polytonic Greek. It is not fully compatible with ISO 8859-7 because the letters like Ά are located at different byte values Windows-1253 ~= ISO-8859-7 

// Turkish Windows-1254 = ISO-8859-9 

// Hebrew Windows-1255 = ISO-8859-8 

// Arabic script like Persian and Urdu Windows-1256 ~= ISO-8859-6 

// Estonian, Latvian and Lithuanian languages Windows-1257 != ISO-8859-4 

// Vietnamese texts. It is very similar to Windows-1252 with the differences being that s-caron and z-caron Windows-1258 ~= Windows-1252 

我使用這些代碼波斯文件名:

$filename=iconv('UTF-8','Windows-1256//IGNORE',$filename);