Page MenuHomePhabricator

Issue generating thumbnails for a filename with accents (wiki.wikimedia.it)
Closed, ResolvedPublic

Description

Penso in seguito all'aggiornamento di PHP c'è un problema sul caricamento di file con accentate. Non viene generato il thumbnail perché i caratteri accettanti vengono rimossi.
Verificato anche con la versione 1.35.0 di un'altro sito. Iconv c'è.
Nel database e sull'interfaccia il nome viene correttamente utilizzato, sembra venga perso nel comando che effettua la conversione per generare i thumbnail.
Wikimedia Italia Tech - Gio 29 Ott 2020 11:26:22 CET

Example:

  • File:Thunderbird gestione identità.png

Relevant documentation:

Event Timeline

My test file was called HòcusPòcusTest.png.

OK this may be caused by a wrong LC_TYPE not compatible with accents. I say this thinking about MediaWiki that probably is calling escapeshellarg() to sanitize the filename argument before passing it to /usr/bin/convert but that function is known to occasionally cause artifacts if you do not set your correct locale:

https://www.php.net/manual/en/function.escapeshellarg.php#99213

I was able to reproduce the problem in another PHP website. From command line it was already working fine (since I have all the LC_* stuff) but from the website itself the accents were dropped. I've fixed adopting this:

setlocale( LC_CTYPE, 'C.UTF-8' );
Restricted Repository Identity mentioned this in Unknown Object (Diffusion Commit).Mar 15 2025, 1:36 PM