glpi-project / glpi-inventory-plugin

GLPI Inventory plugin
GNU Affero General Public License v3.0
43 stars 24 forks source link

Accents isn't being rendered on NetInventory task #503

Closed eduardomozart closed 2 months ago

eduardomozart commented 2 months ago

Describe the bug

We have a network Brother printer and it's Location inventory data is returning with parsing issues. Instead of "Escritório RNetworks" it's returning as seem on screenshot below. image

To reproduce

  1. Set up on network printer the location "Escritório RNetworks".
  2. Do a NetInventory task on device.

Expected behavior

Accents should be handled as expected.

Operating system

Other (See additional context below)

GLPI Agent version

Other (See additional context below)

GLPI version

Other (See additional context below)

GLPIInventory plugin

1.3.5

Additional context

GLPI Agent: 1.7.3 GLPI: 10.0.14

trasher commented 2 months ago

Is the encoding correct in inventory file?

eduardomozart commented 2 months ago

The file is UTF-8 encoded and it seems that the encoding is incorrect there:

<?xml version="1.0" encoding="UTF-8"?>
<REQUEST>
  <CONTENT>
    <DEVICE>
      <CARTRIDGES>
        <DRUMBLACK>91</DRUMBLACK>
        <TONERBLACK>OK</TONERBLACK>
      </CARTRIDGES>
      <FIRMWARES>
        <DESCRIPTION>device firmware</DESCRIPTION>
        <MANUFACTURER>Brother</MANUFACTURER>
        <NAME>NC-8800h</NAME>
        <TYPE>device</TYPE>
        <VERSION>N</VERSION>
      </FIRMWARES>
      <INFO>
        <COMMENTS>Brother NC-8400w, Firmware Ver.N  ,MID 84U-E07</COMMENTS>
        <CONTACT>Suporte TI</CONTACT>
        <FIRMWARE>N</FIRMWARE>
        <ID>2</ID>
        <IPS>
          <IP>192.168.0.197</IP>
        </IPS>
        <LOCATION>Escritório RNetworks</LOCATION>
        <MAC>b4:b5:b6:e3:32:d4</MAC>
        <MANUFACTURER>Brother</MANUFACTURER>
        <MEMORY>32</MEMORY>
        <MODEL>NC-8800h</MODEL>
        <NAME>BRWB4B5B6E332D4</NAME>
        <RAM>32</RAM>
        <SERIAL>U63982B2N294272</SERIAL>
        <TYPE>PRINTER</TYPE>
        <UPTIME>1 day, 07:10:31.70</UPTIME>
      </INFO>
      <PAGECOUNTERS>
        <TOTAL>894</TOTAL>
      </PAGECOUNTERS>
      <PORTS>
        <PORT>
          <IFDESCR>NC-8400w</IFDESCR>
          <IFINERRORS>0</IFINERRORS>
          <IFINOCTETS>5254389</IFINOCTETS>
          <IFINTERNALSTATUS>1</IFINTERNALSTATUS>
          <IFLASTCHANGE>13 minutes, 23.95</IFLASTCHANGE>
          <IFMTU>1500</IFMTU>
          <IFNAME>NC-8400w</IFNAME>
          <IFNUMBER>1</IFNUMBER>
          <IFOUTERRORS>0</IFOUTERRORS>
          <IFOUTOCTETS>1518867</IFOUTOCTETS>
          <IFSPEED>72000000</IFSPEED>
          <IFSTATUS>1</IFSTATUS>
          <IFTYPE>7</IFTYPE>
          <IP>192.168.0.197</IP>
          <IPS>
            <IP>192.168.0.197</IP>
          </IPS>
          <MAC>b4:b5:b6:e3:32:d4</MAC>
        </PORT>
        <PORT>
          <IFDESCR>SoftwareLoopBack</IFDESCR>
          <IFINERRORS>0</IFINERRORS>
          <IFINOCTETS>100</IFINOCTETS>
          <IFINTERNALSTATUS>1</IFINTERNALSTATUS>
          <IFLASTCHANGE>0.00 seconds</IFLASTCHANGE>
          <IFMTU>1500</IFMTU>
          <IFNAME>SoftwareLoopBack</IFNAME>
          <IFNUMBER>2</IFNUMBER>
          <IFOUTERRORS>0</IFOUTERRORS>
          <IFOUTOCTETS>100</IFOUTOCTETS>
          <IFSPEED>0</IFSPEED>
          <IFSTATUS>1</IFSTATUS>
          <IFTYPE>24</IFTYPE>
        </PORT>
      </PORTS>
    </DEVICE>
    <MODULEVERSION>6.1</MODULEVERSION>
    <PROCESSNUMBER>74</PROCESSNUMBER>
  </CONTENT>
  <DEVICEID>server02-2024-04-15-16-08-05</DEVICEID>
  <QUERY>SNMPQUERY</QUERY>
</REQUEST>

It's rendered as expected on Brother UI:

image

Here's snmpwalk output:

C:\Program Files\GLPI-Agent>snmpget -v 2c -c public 192.168.0.197 .1.3.6.1.2.1.1.6.0
SNMPv2-MIB::sysLocation.0 = STRING: Escritório RNetworks
trasher commented 2 months ago

This is an agent issue, please open bug report on agent repository