SNMP and Unicode?
janzen
janzen____pixelmetrix.com
Tue May 8 10:36:54 CEST 2001
christel.sohnemann____philips.com wrote:
> I am just wondering if SNMP is able to transport Unicode strings?
> So for example, if I have a SNMP Agent Application, which works with ASCII strings and there is - let's say - a SNMP Management Application with chinese fonts (UTF8 for example), what happens to the transported strings?
> More precisely: can the SNMP Agent send UTF8 strings or does SNMP only transport ASCII strings?
No, SNMP is not limited to ASCII strings; and yes, you can use UTF-8.
See the description of the SnmpAdminString TC, defined in the
SNMP-FRAMEWORK-MIB (RFC 2571):
SnmpAdminString ::= TEXTUAL-CONVENTION
DISPLAY-HINT "255a"
STATUS current
DESCRIPTION "An octet string containing administrative
information, preferably in human-readable form.
To facilitate internationalization, this
information is represented using the ISO/IEC
IS 10646-1 character set, encoded as an octet
string using the UTF-8 transformation format
described in [RFC2279].
Since additional code points are added by
amendments to the 10646 standard from time
to time, implementations must be prepared to
encounter any code point from 0x00000000 to
0x7fffffff. Byte sequences that do not
correspond to the valid UTF-8 encoding of a
code point or are outside this range are
prohibited.
The use of control codes should be avoided.
When it is necessary to represent a newline,
the control code sequence CR LF should be used.
The use of leading or trailing white space should
be avoided.
For code points not directly supported by user
interface hardware or software, an alternative
means of entry and display, such as hexadecimal,
may be provided.
For information encoded in 7-bit US-ASCII,
the UTF-8 encoding is identical to the
US-ASCII encoding.
UTF-8 may require multiple bytes to represent a
single character / code point; thus the length
of this object in octets may be different from
the number of characters encoded. Similarly,
size constraints refer to the number of encoded
octets, not the number of characters represented
by an encoding.
Note that when this TC is used for an object that
is used or envisioned to be used as an index, then
a SIZE restriction MUST be specified so that the
number of sub-identifiers for any object instance
does not exceed the limit of 128, as defined by
[RFC1905].
Note that the size of an SnmpAdminString object is
measured in octets, not characters.
"
SYNTAX OCTET STRING (SIZE (0..255))
> And if it would be possible to send UTF8 strings by the SNMP Agent and the SNMP Manager only processes ASCII strings, what happens then?
Depends entirely on the implementation of the particular SNMP manager
you're using; specifically, on how it deals with characters in the range
0x80..0xff. Most likely it will either throw them away, display them in
some kind of hex or escaped format (eg. '\xFC'), or display junk (eg.
treat them as if they were ISO 8859-1 characters).
--
Martin Janzen
janzen at pixelmetrix.com
More information about the AGENTPP
mailing list