[SNMP4J] RE: SNMP4J Digest, Vol 60, Issue 4 (Counter64 and Long)

fock at agentpp.com fock at agentpp.com
Wed Jan 7 17:36:47 CET 2009


Hi Mateus,

I have no idea what you are looking for?
Long in Java is 64bit and Counter64 too.
Have you problems whit masking the sign bit?

Also it would be nice to create a new 
posting with using a subject that refers
to the content of the posting.

Thanks,
Frank


Hi Everyone,

	I would like to know if someone knows how to work around the
counter64 -> long limitation ? I found a situation where binding counter64
to Long caused problem.

Many thanks!
Mateus Reyes
R&D - Software Architect
Inixco Systems


-----Original Message-----
From: snmp4j-bounces at agentpp.org [mailto:snmp4j-bounces at agentpp.org] On
Behalf Of snmp4j-request at agentpp.org
Sent: Sunday, January 04, 2009 8:40 AM
To: snmp4j at agentpp.org
Subject: SNMP4J Digest, Vol 60, Issue 4

Send SNMP4J mailing list submissions to
	snmp4j at agentpp.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.agentpp.org/mailman/listinfo/snmp4j
or, via email, send a message with subject or body 'help' to
	snmp4j-request at agentpp.org

You can reach the person managing the list at
	snmp4j-owner at agentpp.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of SNMP4J digest..."


Today's Topics:

   1. Re: UTF Encoding Support (He haobo)


----------------------------------------------------------------------

Message: 1
Date: Sun, 4 Jan 2009 15:15:29 +0800
From: "He haobo" <haobohe at gmail.com>
Subject: Re: [SNMP4J] UTF Encoding Support
To: "Frank Fock" <fock at agentpp.com>
Cc: snmp4j at agentpp.org
Message-ID:
	<acbdb7910901032315p56b3a7e8x119123a5ee03be12 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi Frank,

I took a look at the toString() method of OctetString that is like below.
  public String toString() {
    if (isPrintable()) {
      return new String(value);
    }
    return toHexString();
  }

  public boolean isPrintable() {
    for (int i=0; i<value.length; i++) {
      char c = (char)value[i];
      if ((Character.isISOControl(c) ||
          ((value[i] & 0xFF) >= 0x80)) && (!Character.isWhitespace(c))) {
        return false;
      }
    }
    return true;
  }

So if the value byte array contains Chinese chars, it will not display the
correct Chinese chars and will display the hexadecimal values. You know, in
order to display the Chinese chars correctly, I have to do some encoding
converting just like this.
new String(((OctetString) vb[i].getVariable()).toByteArray(), "gb2312");
After done that, the chinese chars will be correctly displayed. Therefore, I
guess if the value byte array contains Japanese chars, I will also have to
use a Japanese charset to reconstruct the text. Same process will be needed
for other chars such as German, French and so on.

My problem is that I am writing a snmp trap receive client and I can't know
which chars the snmp trap sender(such as cisco router and some kinds of
firewall) will use by advance. So in this case, I have to guess which
charsets the snmp trap sender are using. Do you have any suggestion for this
case? Thanks.


Eternal




2009/1/2 Frank Fock <fock at agentpp.com>

> Hi,
>
> OctetString does not "use" any encoding. As the name
> suggests, it represents an octet string which is
> a (binary) string of 8-bit bytes.
>
> If you convert an OctetString to a String, UTF-8 is
> used by default (Java does that). You are responsible
> to use the correct format as specified in the
> corresponding MIB specification of the object.
>
> Regards,
> Frank
>
>
> karunakaran s.l wrote:
>
>> Hi All,
>>
>>            I want to know the snmp4j's  "OctetString" uses the UTF
>> encoding
>> or not.
>>
>> If it uses the UTF Encoding means what is encoding type (8 or 16). If not
>> using UTF encoding means is any other way of using UTF Encoding for
>> setting
>> the MO Values of type OctetString. (Example: UTF encoding for
>> sysLocation).
>>
>> Please clarify this as soon as possible.
>>
>>
>> Thanks
>> Karunakaran
>> _______________________________________________
>> 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
>
>
>
> _______________________________________________
> 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


End of SNMP4J Digest, Vol 60, Issue 4
*************************************


_______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j



More information about the SNMP4J mailing list