[TYPO3-dev] Where to use setlocale?

Jigal van Hemert jigal at xs4all.nl
Thu Mar 18 12:59:36 CET 2010


Gentlemen,

Thanks for your replies! No fighting, please ;-)

Ernesto Baschny [cron IT] wrote:
> I guess you didn't understand Jigals request. He want to setlocale() in
> the backend, so that escapeshellarg() does not get garbled. He wants an
> idea where he could add it (typo3/config_default, init.php, ...).
> 
> I guess minimal disruption would be to set it around the code that needs
> it (around the escapeshellarg()). And this only if UTF8filesystem
> setting is present.

In a TYPO3 4.1.7 system, wrapFileName just wraps the file name in double 
quotes. UTF8filesystem=0 and any image added with DAM to the system is 
handled correctly by both thumbs.php (BE thumbnails) and 
t3lib_stdGraphic (FE thumbnails).

The same system on 4.2.12 does not display thumbnails (FE+BE) when there 
are diacriticals, etc. in the file name.

The PHP bugszilla tells that if the locale of LC_CTYPE is set properly 
escapeshellarg() will handle diacriticals and other non-ASCII stuff 
correctly. This seems to be working as I added
	setlocale(LC_CTYPE, 'UTF8', 'en_US.UTF-8');
just before the escapeshellarg() in both thumbs.php and t3lib_stdGraphic 
as a test.

thumbs.php is a very limited system, so it probably needs to be set 
somewhere in the setup, but I imagine that t3lib_stdGraphic is called 
when the whole system is already set up.
I'm indeed looking for the right spot to set the locale for LC_CTYPE and 
where to get the right value from for a particular system / language 
configuration / ... (if it is available at all).

-- 
Jigal van Hemert.




More information about the TYPO3-dev mailing list