I have searched all over the Internet and SO, still no luck in the following:
I would like to know, how to properly save a file using file_put_contents
when filename has some unicode characters. (Windows 7 as OS)
$string = "jérôme.jpg" ; //UTF-8 string
file_put_contents("images/" . $string, "stuff");
Resuts in a file:
jГ©rГґme.jpg
Tried all possible combinations of such functions as iconv
and mb_convert_encoding
with all possible encodings, converting source file into different encodings as well.
All proper headers are set, browser recognises UTF-8
properly.
However, I can successfully copy-paste and create a file with such a name in explorer's GUI, but how to make it via PHP?
The last hardcore solution was to urlencode
the string and save file.