make drawing log files more utf-8 friendly, a=chris

Chris Pollett [2021-09-09 20:Sep:th]
make drawing log files more utf-8 friendly, a=chris
Filename
src/controllers/MachineController.php
src/controllers/components/SystemComponent.php
diff --git a/src/controllers/MachineController.php b/src/controllers/MachineController.php
index d67e69f1c..d1ae4dc5a 100644
--- a/src/controllers/MachineController.php
+++ b/src/controllers/MachineController.php
@@ -221,6 +221,7 @@ class MachineController extends Controller implements CrawlConstants
                 $log_data = fread($fh, $len);
                 fclose($fh);
             }
+            $log_data = mb_convert_encoding($log_data, "UTF-8", "UTF-8");
             if (!empty($filter) && strlen($log_data) > 0) {
                 $quote_filter = preg_quote($filter);
                 if(preg_match_all('/.*' . $quote_filter . '.*\n/ui', $log_data,
diff --git a/src/controllers/components/SystemComponent.php b/src/controllers/components/SystemComponent.php
index 5978b28e4..51d3d18fe 100755
--- a/src/controllers/components/SystemComponent.php
+++ b/src/controllers/components/SystemComponent.php
@@ -243,8 +243,8 @@ class SystemComponent extends Component
                                 $parent->clean($_REQUEST[$field], $type);
                         }
                     }
-                    $filter = (isset($r['f'])) ? $r['f'] : "";
-                    $r['channel'] = (isset($r['channel'])) ? $r['channel'] : 0;
+                    $filter = $r['f'] ?? "";
+                    $r['channel'] = $r['channel'] ?? 0;
                     if (isset($_REQUEST["time"])) {
                         $data["time"] =
                             $parent->clean($_REQUEST["time"], "int") + 30;
ViewGit