]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Fix #2560 in restore wizard display names encoded in non-UTF encoding
authorMarcin Haba <marcin.haba@bacula.pl>
Thu, 21 Jan 2021 05:21:36 +0000 (06:21 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Thu, 21 Jan 2021 05:33:46 +0000 (06:33 +0100)
gui/baculum/protected/API/Class/BaculumAPIServer.php

index 568c2a1dd72325f63cb034daca82c2c673032da5..0caf5483073b73b885865b0db7e305b9a805349f 100644 (file)
@@ -236,7 +236,13 @@ abstract class BaculumAPIServer extends TPage {
        private function getOutput() {
                $output = array('output' => $this->output, 'error' => $this->error);
                $this->setOutputHeaders();
-               $json = json_encode($output);
+               $json = '';
+               if (PHP_VERSION_ID >= 70200) {
+                       // Allow displaying characters encoded in non-UTF encoding (supported from PHP 7.2.0)
+                       $json = json_encode($output, JSON_INVALID_UTF8_SUBSTITUTE);
+               } else {
+                       $json = json_encode($output);
+               }
                return $json;
        }