I'm developing a service in PHP that calls a jar file with the exec function, this way:
$text = "string with accents á, ó, ú or العربية";
exec("java -jar jarfile.jar '$text'", $data);
When I test the jar file with the command java -jar jarfile.jar "string with accents á, ó, ú or العربية"
in a linux console it works well and jar file, through System.out.println, returns the text well encoded, but when executed by PHP I recive ?? where should be accented characters or arabic text.
I've tried mb_detect_encoding($data);
and it says its encoding is ASCII, so I've executed $data = mb_convert_encoding($data, 'utf8', 'ASCII');
but still recieving the ?? characters.
Any help in what I should do to get characters with the right encoding?
Thank you.