ietf-smime
[Top] [All Lists]

Re: How to do UTF-8

1998-02-23 07:52:38
In ASN.1 an omitted OPTIONAL variable length item has a single encoding -
absent.  In ASN.1 a value with a missing item is entirely different from
one where the length is zero.

If one is carrying a C language string (null-terminated array of
characters) in a structure with a fixed-size buffer, how does the
application distinguish between absent and zero-length?

Assuming that an ASN.1 library takes a "char *" as an argument, that
argument can be a null pointer or a pointer to "\0", thus from the
library's point of view the encoding is unambiguous.  But from the
application's point of view, it is ambiguous unless one carries around
an additional "empty" flag for each static buffer, or define a special
"length" value of -1 to mean absent.

Of course, I never liked the IEEE floating point distinction between
+0.0 and -0.0 either. :-)

<Prev in Thread] Current Thread [Next in Thread>