【问题标题】:php filenames with international names on windowswindows上带有国际名称的php文件名
【发布时间】:2014-02-24 02:07:08
【问题描述】:

所以,我有一个小代码,它使用 RecursiveDiectoryIterator 和 RecursiveIteratorIterator 定位文件来定位目录中的所有文件。然后我检查文件是否存在,对于某些文件它不存在......

$fromIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir,FilesystemIterator::UNIX_PATHS | FilesystemIterator::SKIP_DOTS));

foreach ($fromIterator as $file)
{
    if (!file_exists($file->getPathname()))
        print $file->getPathname() . "does not exist...\n";
}

我得到一些文件,例如: TÜBITAK_UEKAE_Kök_Sertifika_Hizmet_Saglayicisi_Sürüm_3.txt 不存在...

我需要做些什么来处理这些文件名吗?

【问题讨论】:

标签: php windows internationalization filenames


【解决方案1】:

由于您正在处理特殊字符,我怀疑您使用的是 UTF-8 编码。

我认为file_exists() 不能正确处理 UTF-8 输入。尝试改用file_exists(utf8_decode(...))

【讨论】:

  • 猜对了,但这没有影响。
猜你喜欢
  • 1970-01-01
  • 2010-09-08
  • 1970-01-01
  • 2011-05-24
  • 2019-12-07
  • 2020-10-16
  • 1970-01-01
  • 2014-02-05
  • 1970-01-01
相关资源
最近更新 更多