php.net |  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
Votes:1
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:
 [2008-05-08 11:08 UTC] thomas dot jarosch at intra2net dot com

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-08 11:28 UTC] felipe@php.net
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] jani@php.net
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.

Thomas
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 20:01:57 2014 UTC