Localization in snmp

694 Views Asked by At

We have snmp agent in our product, which sends system alerts to snmp server, and our alerts may be in Unicode. We are using 3rd party lib for sending out, which encodes stings into a ASKII byte array by default. Finally we got garbage on messages.

Is there unicode support for snmp protocol?

2

There are 2 best solutions below

0
On

As Lex Li already mentioned SNMP does not care about string encoding. The OCTET STRING is just a byte array. So when you have to deal with localization/ internationalization the proper solution is definitely the use of UTF-8 encoding/decoding. But keep in mind that SNMP4J and many other libraries treat byte array as ASCII string in methods like toString(). So you'll have to write your own extensions.

2
On

It is the SNMP agents job to localize the message properly. It is the SNMP management tool's job to decode the message properly.

A WireShark trace will show whether your agent put the correct byte array on the wire. If your message is Unicode the bytes should start with a valid Unicode preamble.

Also depending on your device type there are other areas in the agent's MIB that help the management tool decode the message properly.

For example the prtLocalizationTable for printers should show support for Unicode, and prtGeneralCurrentLocalization helps management tools know how to decode the message properly.