From a4cbd1b7ec59af2d2ebea363fe6bba7766c34fd7 Mon Sep 17 00:00:00 2001 From: Dmitry Khomutov Date: Sun, 3 Sep 2017 11:11:03 +0700 Subject: [PATCH 1/2] Fixes for non-unicode binary log output. Issue #116. --- src/PHPCensor/Helper/CommandExecutor.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PHPCensor/Helper/CommandExecutor.php b/src/PHPCensor/Helper/CommandExecutor.php index 40de3b10..82ef3ad0 100644 --- a/src/PHPCensor/Helper/CommandExecutor.php +++ b/src/PHPCensor/Helper/CommandExecutor.php @@ -102,6 +102,9 @@ class CommandExecutor implements CommandExecutorInterface $status = proc_close($process); } + mb_substitute_character(ord('?')); + + $this->lastOutput = mb_convert_encoding($this->lastOutput, 'utf8', 'utf8'); $this->lastOutput = array_filter(explode(PHP_EOL, $this->lastOutput)); $shouldOutput = ($this->logExecOutput && ($this->verbose || $status != 0)); From 883ebf1a1a866f6d34c2993e0719687e5c3ac5dd Mon Sep 17 00:00:00 2001 From: Dmitry Khomutov Date: Sat, 9 Sep 2017 16:03:50 +0700 Subject: [PATCH 2/2] =?UTF-8?q?Changed=20'=3F'=20to=20'=EF=BF=BD'=20for=20?= =?UTF-8?q?binary=20output.=20Issue=20#116.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/PHPCensor/Helper/CommandExecutor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PHPCensor/Helper/CommandExecutor.php b/src/PHPCensor/Helper/CommandExecutor.php index 82ef3ad0..c6b13d0f 100644 --- a/src/PHPCensor/Helper/CommandExecutor.php +++ b/src/PHPCensor/Helper/CommandExecutor.php @@ -102,7 +102,7 @@ class CommandExecutor implements CommandExecutorInterface $status = proc_close($process); } - mb_substitute_character(ord('?')); + mb_substitute_character(65533); $this->lastOutput = mb_convert_encoding($this->lastOutput, 'utf8', 'utf8'); $this->lastOutput = array_filter(explode(PHP_EOL, $this->lastOutput));