narek
narek

Reputation: 1036

PHP escape shell arg unwanted behaviour

When I do escapeshellarg('référencement') it returns 'rfrencement'. How can we resolve the problem ?

Upvotes: 3

Views: 1457

Answers (1)

Adam Wright
Adam Wright

Reputation: 49376

This is almost certainly due to your system locale. What string encoding are you using for your argument, versus the encoding set as the locale? As a debugging step, you can try forcing UTF-8 with

setlocale(LC_CTYPE, "en_US.UTF-8");

before you call escapeshellarg, and see if that helps.

Upvotes: 7

Related Questions