ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-dev
php-dev
#44945 [Opn->Bgs]: escapeshellarg removes UTF-8 multi-byte characters
by jani other posts by this author
Jul 13 2008 10:01AM messages near this date
#44945 [Bgs]: escapeshellarg removes UTF-8 multi-byte characters | #44945 [Opn]: escapeshellarg removes UTF-8 multi-byte characters
ID:               44945
 Updated by:       jani@[...].net
 Reported By:      thomas dot jarosch at intra2net dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Strings related
 Operating System: Linux
 PHP Version:      5.2.6
 New Comment:

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..


Previous Comments:
------------------------------------------------------------------------

[2008-05-08 12:59:36] 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-05-08 11:28:25] felipe@[...].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 11:08:27] thomas dot jarosch at intra2net dot com

Description:
------------
Hello together,

I'm seeing almost the same issue as #44564
after upgrading from PHP 5.2.5 to 5.2.6.

If I execute the provided test code via php CLI, everything works as 
expected. Running the same code via mod_php inside Apache skips the 
UTF-8 multi-byte characters.

I've looked at the ext/standard/exec.c code a bit and checked that 
my "config.log" in both PHP build directories contains
"#define HAVE_MBLEN 1" so the call to php_mblen() should work.

Any idea what that could be?

One thing I noticed is that php_mblen() is a wrapper macro for 
mblen() or mbrlen() which features a slight difference in the return 
code (see -2 rc for details).

Thanks,
Thomas


Reproduce code:
---------------
var_dump(escapeshellarg('�'));

Expected result:
----------------
string(2) "'�'"

Actual result:
--------------
string(2) "''"


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44945&edit=1
Thread:
Thomas Dot Jarosch At Intra2net Dot Com
Thomas Dot Jarosch At Intra2net Dot Com
jani
Thomas Dot Jarosch At Intra2net Dot Com
felipe

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved