There is a php handler that executes commands like in an exec loop
exec(icacls "\\\\10.0.7.41\\project\\1111_Проект\\01_Подраздел\\19.09.2018_альбом" /inheritance:e /T, $systemMessage);
The utf8 script file encoding without BOM
In the loop about a hundred folders are moved. The execution results are placed in the systemMessage. Tell me how to work correctly with the encoding in which windows returns $systemMessages , An example of what I get by executing on the command line:
But what I get when I try to display data on the screen in a browser or write to a log file
foreach ($systemMessages as $message){ echo $message; file_put_contents($fileName , $message . PHP_EOL, FILE_APPEND); } On the screen:
It seems to be all right, but when you look into the file, there: 
What to do with the $ message element in the $ userMessages array, what would it correctly write to the file?
Пробовал iconv("windows-1251","utf-8",$message) Does not help.
