在PHP的Filesystem functions中处理UTF-8 FileNames
来解决此问题,请使用urlencode函数将所需的文件夹名称转换为URL-SAFE格式,然后再将其传递给mkdir:这确保文件夹名称中的所有字符均已编码为所有操作系统的有效文件名。要检索原始的UTF-8文件名,请使用uroldecode。
替代解决方案(带有警告)Restrict to ISO-8859-1 Characters
Alternatively, limit filenames to characters representable in ISO-8859-1. Use utf8_decode and utf8_encode to convert filenames between UTF-8 and ISO-8859-1.However, these alternatives come with caveats:$dir_name = urlencode("Depósito"); mkdir($dir_name);
Filesystem functions cannot handle bytes that match invalid Windows filesystem characters in ISO-8859-1.
Windows may use非英语环境中的非ISO-8859-1编码,需要更复杂的转换。
免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3