UTF-8 characters and upload feature
-
Hi.
I know this thread isn’t quite about WordPress itself and is more about PHP coding, but it was my last hope to post in here.
I’m using the function move_uploaded_file so that users can upload files into the system. But the problem is when they upload files that have Persian characters in their names, the uploaded file will have totally random unreadable characters in its name.
I searched through many forums and tried many functions like iconv, quoted_printable_encode / quoted_printable_decode, mb_convert_encoding, but none worked. Because I believe they come into action right before move_uploaded_file function, so the output will always be the same.
Many people said it was due to some problem with the function itself, which was later fixed in PHP 7.
But the thing is, WordPress is perfectly doing the job even on lower versions, when PHP 7 was not even born. On WordPress v3.8 for instance, when you upload a file with Persian name, the original name with its encoding will be kept and used.
So I decided to come around here asking for some help or hints to know what trick WordPress is using.
My question is very simple, but the answer is not, I perfectly know. But even small hints will be highly appreciated.
Just to mention that, I have very basic knowledge of PHP and absolute zero knowledge of WordPress coding.
Thanks,
- The topic ‘UTF-8 characters and upload feature’ is closed to new replies.