fix: grabled characters when oid already UTF-8 (#15615)

This commit is contained in:
Mitt
2023-12-05 21:13:16 +08:00
committed by GitHub
parent c88fba0b64
commit 273c6c5b97
2 changed files with 7 additions and 3 deletions

View File

@@ -22,6 +22,9 @@
* @copyright 2020 Denny Friebe
* @author Denny Friebe <denny.friebe@icera-network.de>
*/
use LibreNMS\Util\StringHelpers;
$cmc_iii_var_table = snmpwalk_cache_oid($device, 'cmcIIIVarTable', [], 'RITTAL-CMC-III-MIB', null);
$cmc_iii_sensors = [];
@@ -77,7 +80,7 @@ foreach ($cmc_iii_var_table as $index => $entry) {
}
// encode string to ensure that degree sign may be used properly for unit comparison
$unit = utf8_encode($entry['cmcIIIVarUnit']);
$unit = StringHelpers::inferEncoding($entry['cmcIIIVarUnit']);
$type = 'state';
$temperature_units = ['degree C', 'degree F', '°C', '°F'];
if ($unit == 'mA') {