Problem with encoding in a map
trentasis opened this issue · comments
We were able to circumvent the problem addiing in the file /usr/local/nagvis/share/server/core/classes/NagVisMap.php
This line in 116
$arrRet=unserialize(iconv('UTF-8', 'ASCII//TRANSLIT', utf8_encode(serialize($arrRet))));
return json_encode($arrRet);
Instead of:
return json_encode($arrRet);
The previous fix didn't work finally, but we have a new one that fixes non-utf8 characters displayed on the maps.
file /usr/local/nagvis/share/server/core/classes/NagVisMap.php
This line in 116
function mb_unserialize($string) {
$string = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':"$2";'", $string);
return unserialize($string);
}
if (mb_detect_encoding(serialize($arrRet), 'UTF-8', true)) {
}
else{
$arrRet=mb_unserialize(utf8_encode(serialize($arrRet)));
}
return json_encode($arrRet);
}
}