如果我写:
rename('php109.tmp','test.jpg');
然后就可以正常工作了。
但是如果我把它改成:
rename('php109.tmp','中文.jpg');
它会报告
"No such file or directory...".
但是如果多字节字符可以写入数据库然后可以读出,那么重命名时为什么会失败?
最佳答案
文件系统不一定使用 UTF-8。例如,这就是维基百科关于 NTFS 的说法。 :
NTFS allows any sequence of 16-bit values for name encoding (file names, stream names, index names, etc.). This means UTF-16 codepoints are supported, but the file system does not check whether a sequence is valid UTF-16 (it allows any sequence of short values, not restricted to those in the Unicode standard).
您可能需要使用 iconv()在字符集之间进行转换。
关于php - 重命名不支持多字节字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/873853/