Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When uploading files with special caracteres, e.g. ç,ã,é,ü,ì etc, the files are saved with different characters and after it didn't get the file.
"çãéüì.txt" turn in "çãéüì.txt"
Sorry for my english, i'm Brazilian.
And it's my first bug report, sorry if i do anything wrong.
Comment | File | Size | Author |
---|---|---|---|
#18 | аАЕёЁиИйЙоОуУъЪыЫьЬэЭюЮяЯ.png | 11.12 KB | andypost |
#10 | Selection_028.png | 26.73 KB | kotnik |
imagem.JPG | 96.54 KB | anderson.ribeiro |
Comments
Comment #1
anderson.ribeiro CreditAttribution: anderson.ribeiro commentedComment #2
marcvangendFiling under 7.x-dev so it will get the attention is needs. I'm not sure this is critical though.
Comment #3
lotyrin CreditAttribution: lotyrin commentedAre we not transliterating filenames in core? I tried uploading a file named "ウィキペディア.txt" (contains only Japanese katakana) and get:
Comment #4
lotyrin CreditAttribution: lotyrin commented+1 for this being critical. I'd say it's pretty common for users to need to be able to upload files with names in their own language.
Comment #5
cleaver CreditAttribution: cleaver commentedThis functionality can be provided by the transliteration module: http://drupal.org/project/transliteration
If it is decided that this needs to be in core, then some of the transliteration code could be adopted.
Comment #6
anderson.ribeiro CreditAttribution: anderson.ribeiro commentedSince the upload of files is in core, so i think that the transliteration is important to be in core.
Comment #7
catchIt's a good idea but it's too late for Drupal 7.
Comment #8
lotyrin CreditAttribution: lotyrin commentedMaybe doing transliteration is a future task, but for now these files need to at least get uploaded and stored in a way that we can use them in combination with things like image formats.
Even if what we do is detect when there are invalid characters and replace the whole file name with a number.
Comment #9
lotyrin CreditAttribution: lotyrin commentedComment #10
kotnik CreditAttribution: kotnik commentedI just tried to upload çãéüì.jpg to an article, and it completely eat the file. This is critical.
Comment #11
andypostI always use transliteration module. But suppose better to leave it in contrib because not all sites are used with file uploads.
Comment #12
lotyrin CreditAttribution: lotyrin commentedI don't see filename transliteration as a feature that belongs in contrib, but rather a bug fix that belongs in the file module (and therefore, belongs in core).
Unless, of course, there is a simpler alternative for fixing this.
Comment #13
andypost@lotyrin transliteration could be changed more often then core because of nature of languages and charsets. So better drop a line in readme pointing to project page.
Also there probability that some users wont use transliteration so anyway this should be configurable
Comment #14
webchickI can't reproduce #10? I named the image as specified and it shows up fine for me:
When I view the URL in my browser (Firefox or Safari), I see the name of the file as expected:
What are the steps to actually break this?
Comment #15
webchickOh. And please follow those same steps in Drupal 6 with Upload module and report the results. I have a hunch the behaviour is the same. If so, this is a Drupal 8 issue.
Comment #16
andypostMostly this depends on file-system you are using at server. cant reproduce now.
Comment #17
lotyrin CreditAttribution: lotyrin commentedHmm. I am on a new server, so I guess I can't guarantee that this isn't an issue with my server configuration. If #14 worked, I guess it works on at least some Apache/PHP/filesystem configurations, isn't a bug in File and seems more like a documentation issue (making sure users know how to configure their server for UTF8 filenames)
I'll try to figure out exactly what needs to exist server-side to allow these files to be saved properly and make sure those steps exist in documentation somewhere.
Comment #18
andypostAttaching this file causes cut-off first word
Original filename:
Андрей аАЕёЁиИйЙоОуУъЪыЫьЬэЭюЮяЯ.png
Saved filename:
аАЕёЁиИйЙоОуУъЪыЫьЬэЭюЮяЯ.png
Screen attached as original filename, so D6 works exactly the same
Comment #19
kotnik CreditAttribution: kotnik commentedI did a bit of research, and this is not related to Drupal, but PHP's environment is not set properly.
Basename function is removing characters cause the results of the basename() function are dependent on your locale setting.
If you want to reproduce, go to file.inc on the 1196th line. Before that add something like:
That was the case with my system, and that's how I got the screenshot above.
After setting locale to:
Everything works fine.
So, this should at least be documented, or Drupal could set locale depending on language?
Comment #20
Rob Carriere CreditAttribution: Rob Carriere commentedYou can set locale, but that only helps if the underlying stack (PHP and OS) actually supports that locale, so by itself it is not a reliable solution.
I can confirm that Drupal 6 has the same issue if the underlying OS has the issue (been there multiple times...).
Comment #21
kotnik CreditAttribution: kotnik commentedPHP's setlocale returns FALSE if the locale functionality is not implemented, and in that case Drupal could note user on Status Report.
I think that this should go to 8.x-dev, where Drupal would set correct locale, depending on the site language, and if it fails, user would be notified about that on Status Report page. From my experience, almost all systems support all locales (all Windows do by default), and this would prevent future issues about this.
Comment #22
Damien Tournoud CreditAttribution: Damien Tournoud commentedSo this is a duplicate of #278425: Using basename() is not locale safe. Let's help get this other issue in.