Bug #54391 [Com]: escapeshellarg strip non-ascii characters

From: Date: Tue, 07 Feb 2017 11:06:20 +0000
Subject: Bug #54391 [Com]: escapeshellarg strip non-ascii characters
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207208@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=54391&edit=1

 ID:                 54391
 Comment by:         netvicious at gmail dot com
 Reported by:        c dot madmax at gmail dot com
 Summary:            escapeshellarg strip non-ascii characters
 Status:             Open
 Type:               Bug
 Package:            Program Execution
 Operating System:   any
 PHP Version:        any
 Block user comment: N
 Private report:     N

 New Comment:

This bug seems to be on the limbo so much time.

I get here looking for a solution but it only guided me to found my solution.

For me it worked with a setlocale(LC_ALL, 'es_ES@euro'), it didn't worked with
setlocale(LC_ALL, 'es_ES@iso-8859-1') and others but I think it should be a problem with
the locales on the linux configuration.

Run a locale-gen in your machine and look which locales do you have installed on your machine, and
use one of they.


Previous Comments:
------------------------------------------------------------------------
[2015-02-03 07:01:59] yohgaki@php.net

Duplicate.
https://bugs.php.net/bug.php?id=45132
Keep this bug open.

------------------------------------------------------------------------
[2013-02-03 23:54:21] me at paulofreitas dot me

Test script:
---------------
<?php

$filename = 'résumé.pdf';

var_dump(escapeshellarg($filename));
setlocale(LC_CTYPE, 'en_US.utf8');
var_dump(escapeshellarg($filename));

?>

Test result when executed from CLI:
---------------
string(14) "'résumé.pdf'"
string(14) "'résumé.pdf'"

Test result when executed from Apache:
---------------
// Executed from Apache
string(10) "'rsum.pdf'"
string(14) "'résumé.pdf'"

Which locale to use? Will it works cross-platform? Yeah, that's a very annoying unexpected
behavior.

------------------------------------------------------------------------
[2011-03-26 15:35:48] c dot madmax at gmail dot com

This is a different bug!

Bug 44945 is related to utf-8 strings, and the bug is fixed. escapeshellarg() don't remve valid
utf-8 characters.

But escapeshellarg() remove ISO-8959-1 characters!

------------------------------------------------------------------------
[2011-03-26 15:18:54] felipe@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php



------------------------------------------------------------------------
[2011-03-26 15:18:43] felipe@php.net

See bug #44945

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=54391


--
Edit this bug report at https://bugs.php.net/bug.php?id=54391&edit=1


Thread (9 messages)

« previous php.bugs (#207208) next »