1

I used dirscan php function to get an array of filename, it return an array like following:

[8] => ?????? ?????.js
[9] => ???????? ?????  ??? ?????.js
[10] => ???????? ???????????? ????????.js
[11] => ?????????? ???.js
[12] => A Contra Corriente.js
[13] => ABC-CLIO Serials Web.js
[14] => ACL.js

first three are files that their name are in Cyrillic alphabet. What should I do to get correct filenames?

Handsome Nerd
  • 17,114
  • 22
  • 95
  • 173
  • That depends on the (file) system and what it encodes those names with. What system are you running on? – deceze Jun 20 '12 at 12:03
  • This question is similar to the one you've asked: http://stackoverflow.com/questions/708017/can-a-php-file-name-or-a-dir-in-its-full-path-have-utf-8-characters – Zack Zatkin-Gold Jun 20 '12 at 12:18
  • @DexterHuinda I changed `default_charset = "iso-8859-1"` to `default_charset ="UTF-8"` but nothing changed – Handsome Nerd Jun 20 '12 at 13:05

1 Answers1

4

I am using win7 ntfs

Sorry, PHP running under Windows can't support filenames containing general Unicode characters. It can only cope with filenames made entirely of characters that lie within the current code page.

That code page is probably 1252 for you (Western European, similar to ISO-8859-1), which doesn't contain Cyrillic. If you run it on a Russian-language install then your code page would be 1251, and the Cyrillic characters would work - but accented Latin would break.

This is a problem that affects all applications that use the standard C stdio library calls from the MS C runtime, including PHP, Java and others. (Some languages, like Python, have special support for Unicode filenames using Windows-specific APIs instead of the C stdlib; there is Request 45517 to get the same into PHP but don't hold your breath.)

On non-Windows platforms, Unicode tends to be supported by using byte strings with the UTF-8 encoding, and so all Unicode characters just work. Unfortunately Windows does not have this capability (code page 65001 is kind-of UTF-8, but badly broken).

bobince
  • 528,062
  • 107
  • 651
  • 834