File_get_contents does not work with non-english filenames in DRUPAL

I have a problem. file_get_contents and other file functions (like file, fopen, glob, etc.) don't work when I try to get a file with non-english characters. I am getting error that the file does not exist. This happens when I use any of these functions from my simple drupal module. But at the same time, when I try to use file_get_contents outside of drupal code (just created separate php file), this function works as it should.

Do you have any advice? What does drupal do, I can't use file functions in a file with a non-english name from my module?

Thanks.

+2
php drupal


a source to share


2 answers


Are you using urlencode () for your name? If not, you need to.



+1


a source to share


There is a Transliteration module , I believe it will help you a lot. More details about this module (from the project page):



Provides one-way transliteration of strings (romanization) and cleans up filenames at boot time, replacing unwanted characters.

In general, it takes Unicode text and tries to represent it in US-ASCII characters (universally displayable, useless characters), trying to transliterate the pronunciation expressed by text in some other writing system into Roman letters.

According to Unidecode, from which most of the transliteration data was derived, "Russian and Greek seem to work discreetly, but it doesn't work well in Japanese and Thai."

0


a source to share







All Articles