mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: grabled characters when oid already UTF-8 (#15615)
This commit is contained in:
@@ -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') {
|
||||
|
@@ -6,6 +6,7 @@ use LibreNMS\RRD\RrdDefinition;
|
||||
use LibreNMS\Util\Debug;
|
||||
use LibreNMS\Util\Mac;
|
||||
use LibreNMS\Util\Number;
|
||||
use LibreNMS\Util\StringHelpers;
|
||||
|
||||
// Build SNMP Cache Array
|
||||
$data_oids = [
|
||||
@@ -676,9 +677,9 @@ foreach ($ports as $port) {
|
||||
// handle legacy '1' setting, otherwise use value set by override
|
||||
$current_oid = $ifAlias_override === '1' ? $port['ifAlias'] : $ifAlias_override;
|
||||
} else {
|
||||
$current_oid = \LibreNMS\Util\StringHelpers::inferEncoding($this_port['ifAlias']);
|
||||
$current_oid = $this_port['ifAlias'];
|
||||
}
|
||||
$current_oid = utf8_encode($current_oid); // prevent invalid non-utf8 characters
|
||||
$current_oid = StringHelpers::inferEncoding($current_oid); // prevent invalid non-utf8 characters
|
||||
}
|
||||
if ($oid == 'ifSpeed') {
|
||||
$ifSpeed_override = DeviceCache::getPrimary()->getAttrib('ifSpeed:' . $port['ifName']);
|
||||
|
Reference in New Issue
Block a user