escapeshellarg() has problems with non-ASCII filenames

Created on 26 March 2012, about 13 years ago
Updated 20 January 2025, 5 months ago

This module fails to process files with non-ASCII filenames. It is because LC_ALL is set to 'C' in includes/bootstrap.inc and then escapeshellarg() strips out non-ASCII characters. A quick-and-dirty workaround is to enclose the line in _imagemagick_convert() with two setlocale() calls:

  setlocale(LC_ALL, 'en_US.UTF-8');
  $command = escapeshellarg($source) . ' ' . implode(' ', $args) . ' ' . escapeshellarg($dest);
  setlocale(LC_ALL, 'C');

Or you can just modify the bootstrap.inc directly; I've done that before and found no problems. I think the core should provide its own implementation of escapeshellarg() and other locale-dependent functions as it forces LC_ALL to 'C'.

🐛 Bug report
Status

Closed: outdated

Component

Miscellaneous

Created by

🇰🇷South Korea C. Lee

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024