[SNMP4J] Re:SNMP4J Digest, Vol 59, Issue 15 Does snmp4j support Unicode chars in trap?

Frank Fock fock at agentpp.com
Wed Dec 31 10:41:33 CET 2008


Hi Eternal,

The MIB specification has to define which character
set to use. To support all languages, UTF-8 (UTF-16)
should be used.

You cannot recognize which character set is used
by the data send - you can guess, but in many cases
the guess will be wrong.

Since Java uses UTF internally, you will be set if
the MIB specifies UTF.

Best regards,
Frank

He haobo wrote:
> Hi,
> 
> I also need to support Japanese, French, German charsets and so on. So is
> there a way to identify which charset the snmp trap sender is using? Or is
> there a direct method to constrct the String just like this:
>  new String(((OctetString) vb[i].getVariable()).toByteArray());
> 
> You know, if I have to use something like "gb2312" in the codes, the
> charsets will be hardcoded and is not a flexible way. Any suggestion for
> this issue? Thanks.
> 
> Eternal
> 
> 
>> You can try to transform the with apropriate charactor set.
>>> return new String(((OctetString) vb[i].getVariable())
>>>       .toByteArray(), "gb2312");
>>> _______________________________________________
>>> SNMP4J mailing list
>>> SNMP4J at agentpp.org
>>> http://lists.agentpp.org/mailman/listinfo/snmp4j
>>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the SNMP4J mailing list