From 1d30b1d0d0933a621fb9b3cc9f9dea0f7d6d4a4a Mon Sep 17 00:00:00 2001 From: Red Shen Date: Mon, 25 Nov 2019 10:36:04 +0800 Subject: [PATCH] Use mb_convert_encoding() to avoid json_decode() failure Note: php-mbstring needs to be installed and enabled. --- phplib/utils.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phplib/utils.php b/phplib/utils.php index df5e6e0..9119e55 100644 --- a/phplib/utils.php +++ b/phplib/utils.php @@ -49,7 +49,8 @@ static function fetch_json($hostname,$port,$protocol,$url) { "details" => $errmsg ]; } else { $ret["curl_stats"] = ["$hostname:$port" => curl_getinfo($ch)]; - $ret["details"] = json_decode($json, true); + $filtered_json = mb_convert_encoding($json, "UTF-8", "UTF-8"); + $ret["details"] = json_decode($filtered_json, true); } curl_close($ch);