upload an image to your local image folder - using FTP, not Joomla - with accents in the filename
THESE ACCENTS NEED TO NOT BE UTF-8 ENCODED !! This is important.
Then navigate to Admin -> Content -> Media
Note the blank screen where you would expect images/folders to show
Examples (as an example only, DO NOT COPY AND PASTE THESE!):
Filename |
---|
07_CALÍOPE_topticket.jpg |
Bànner_web.png |
còpia.jpg |
Dúo.jpg |
To create a non-uff-8 accented file - on file systems that allow it (MacOS Doesnt!) - you can use this PHP script:
file_put_contents("/path/to/images/umlaut_\xFC.png",file_get_contents('/path/to/images/joomla_black.png'));
Media manager should work correctly, handling the accents correctly, like it does accents that are utf-8
AT A MINIMUM media manager should report an error message if the AJAX response is blank, or contains error messages.
AT BEST being able to convert and display non-uff-8 filenames
The API AJAX CALL returns a blank screen and 200 OK response.
This happens because the list of files is provided to a JsonResponse
which is case __toString
using json_encode
with no error handling. When json_encode
fails, it returns an empty string.
If json_encode
is used with JSON_THROW_ON_ERROR
(while debugging) then the real error becomes apparent in the body of the AJAX response which shows Malformed UTF-8 characters error message, but com_media does not look for error messages/Exceptions in the JSON and so doesnt show this error message anyway, and also doesnt show any error message if the response is a blank response body... it just sits there with a moving blue loading indicator forever.
If you var_dump
before the json_encode
you can see the "malformed" characters (if you view using a UTF-8 encoded browser page)
Yes I could fix this, but its best fixed by someone who uses non-standard encodings and who can replicate and test. This is best done with someone on a linux operating system and not a MacOS.
Please dont tell me you cannot replicate this problem, if you are just copy and pasting accents from the web... in UTF-8 /facepalm.
Seen in the real world twice with German accents written in filenames and files uploaded over FTP - NOT files uploaded by Joomla whose filenames are written by Joomla. Seen also with other (non-joomla) galleries that create the images online, and save them to the file system with non-utf8 filenames.
Want to learn more? see: https://evertpot.com/filesystem-encoding-and-php/
Labels |
Added:
No Code Attached Yet
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-03-07 18:36:18 |
Closed_By | ⇒ | PhilETaylor |
Also (kindof) related #36061