PHP encoding - UTF-8

With cURL I am saving files which have UTF-8 chars in filename. For example:

testšć.docx

When I used mb_detect_encoding() it returned me ASCII. So i tried to convert it with iconv from ASCII to UTF-8 and from UTF-8 to UTF-8. Neither option worked.

So anyone has some suggestion how could I keep UTF-8 file names?

Cheers!

Answers


Your file system (and operating system) must support UTF-8 encoded file names in order to retain files that use UTF-8 in the file name. If either do not support that, then the best option is to either convert them into a known transliteration, or discard (replace) the characters that cannot be converted.


In analogy with MySQL, when your MySQL data is encoded in UTF8 you should have php read it through a UTF8 "communication" so since your HTML data is in UTF8 i think your problem is (tho i don't have all your code to know if im correct) that you are not reading it as UTF8

Try adding this option to your cURL config:

curl_setopt( $ch, CURLOPT_ENCODING, "UTF-8" );  

I don't know if this IS what you are missing, but in case not let me know and i'll update my answer...


Need Your Help

.js ScrollTop to div or section tag

javascript jquery css html5 css3

I have the following script that allows me to add an anchor-link with a .class attached to my HTML document, which would then scroll the user to a position on the webpage when clicked on.

Assembly code for Neon Intrinsic Version

android assembly android-ndk neon

I am new to Neon Assembly programming, I have developed a Neon Intrinsic version of video edge detection algorithm, it resulted in gaining 2x performance. Now I would like to try Neon assembly - I ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.