glpi-project / glpi-agent

GLPI Agent
GNU General Public License v2.0
212 stars 51 forks source link

Fix accents rendering on Location #653

Closed eduardomozart closed 2 months ago

eduardomozart commented 2 months ago

This is a safe approach, but maybe could be applied to other string fields as well. This fixes https://github.com/glpi-project/glpi-inventory-plugin/issues/503

g-bougard commented 2 months ago

Hi @eduardomozart

I'm not convinced this is the right thing to do. It works in your case, and this is a specific case. The function you modify is used from many other places and I think you will broke some features.

Before choosing a solution, I need you provide a snmpwalk in the expected format. The question here is first to find how this field is really encoded. The issue may still be you setup this field on the device in a wrong way.

eduardomozart commented 2 months ago

The device location accepts accents (e.g. "ó", which is triggering the issue). Here's full snmpwalk output as requested: brother-hl-1210w.walk.txt

g-bougard commented 2 months ago

Hi @eduardomozart

thank you for the walk.

It helped me to reproduce the case and I just submitted a fix which is decoding the UTF-8 string in the right place: getCanonicalString() from GLPI::Agent::Tools::SNMP module.

It fixes your case and also a lot more on our private snmp walk repository.