From 1abe45c66255f09579d145cec45159a6a1e5e601 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Thu, 22 Nov 2018 12:29:25 +0100 Subject: [PATCH] Fix encoding related issues. Ref pandora_enterprise#3031. --- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/Tools.pm | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 30423808c9..dd2c8d4a32 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -507,7 +507,7 @@ sub pandora_load_config { } # Collect items from config file and put in an array - if (! open (CFG, "< $archivo_cfg")) { + if (! open (CFG, "<:encoding(UTF-8)", $archivo_cfg)) { print "[ERROR] Error opening configuration file $archivo_cfg: $!.\n"; exit 1; } diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index 195443656f..848a2636d9 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -175,6 +175,7 @@ if ($OS eq 'linux') { } elsif ($OS =~ /win/i) { $OS = "windows"; $OS_VERSION = `ver`; + $OS_VERSION =~ s/[^[:ascii:]]//g; $DEVNULL = '/Nul'; } elsif ($OS eq 'freebsd') { $OS_VERSION = `uname -r`;