|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44945 escapeshellarg removes UTF-8 multi-byte characters
Submitted: 2008-05-08 11:08 UTC Modified: 2008-07-16 13:39 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: thomas dot jarosch at intra2net dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.2.6 OS: Linux
Private report: No CVE-ID: None
 [2008-05-08 11:08 UTC] thomas dot jarosch at intra2net dot com


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-08 11:28 UTC]
Try with the code below (mandatory in the test):

if (false == setlocale(LC_CTYPE, "UTF8", "en_US.UTF-8")) {
	die("skip setlocale() failed\n");
 [2008-05-08 12:59 UTC] thomas dot jarosch at intra2net dot com
Thanks, that seems to work.

I've inspected the environment on the server and it contains a 
LANG="en_US.UTF-8" variable. Is there a way I can fix this/PHP 
autodetects it without touching every code using escapeshellarg()?
 [2008-07-13 17:01 UTC]
There's no automatic way. If you need to have it work with utf-8 of course you have to set the locales properly too. Or just not use UTF-8..
 [2008-07-16 13:39 UTC] thomas dot jarosch at intra2net dot com
Thanks for looking into this, Jani.

So, why does it work via CLI and not via apache if the same LANG 
environment variable is specified? I've even seen 
an "AddDefaultCharset UTF8" entry in the apache config.

PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC