开发者

Creating folders with names that includes non-ASCII characters

开发者 https://www.devze.com 2023-04-02 07:42 出处:网络
i am creating folders from PHP with non-ASCII characters in their names. e.g ¡Mucho gusto!, Adiós, Buenos días.

i am creating folders from PHP with non-ASCII characters in their names. e.g ¡Mucho gusto!, Adiós, Buenos días.

I'm using the mkdir() function. When my script executes the folder created on my drive is a mess. ¡Mucho gusto! becomes ¡Mucho gusto! with similar problems for other names. The HTML document cont开发者_JAVA技巧aining the PHP script has its charset set to utf-8, but Windows corrupts the folder name. When i tested it on my server, the folder name was correct but locally there is sumthing wrong with the Windows setting. I am using Windows XP SP3.


I would recommend you to encode the folder names with Punycode. Since all common OS have restrictions for folder names.

There is a online demo for Punycode here. And also a PHP class is available for the automatic translation.


got it!! i need to utf8_decode() my path before making the mkdir() call cauze the windows xp expects and deliver the folder name in ISO-8859-1.

0

精彩评论

暂无评论...
验证码 换一张
取 消