2

I have PHP installed on a CentOS server, and I wanna transfer files from this (with PHP FTP) to a Windows FTP server that is running IIS. Now my problem, when the file name have non-latin characters it changes file names to something like 'تست.3gp' (its name in CentOS is تست.3gp) I 've searched many times but no solutions. How can I fix this?

I think Windows use CP-1252 (Windows-1252) as charset and CentOS use UTF-8 as charset. But converting this with iconv() and mb_convert_encoding() didn't work.

Skurmedel
  • 21,515
  • 5
  • 53
  • 66
IVIR3zaM
  • 567
  • 9
  • 23

2 Answers2

0

I have found my answer after many researches. windows use different charset for different languages. and for coding to these charset we can use this class: http://www.phpclasses.org/package/1360-PHP-Conversion-between-many-character-set-encodings.html

IVIR3zaM
  • 567
  • 9
  • 23
0

also we can use these codings in 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

I use these codes for persian file names:

$filename=iconv('UTF-8','Windows-1256//IGNORE',$filename);
IVIR3zaM
  • 567
  • 9
  • 23