[erlang-questions] Decoding of ASN.1 BER files (now with added UTF8)

Bruce Fitzsimons <>
Mon Oct 1 04:00:54 CEST 2007

Anders Nygren wrote:
> On 9/29/07, Bruce Fitzsimons <> wrote:
>> almost work perfectly (proven for BER at least), you only need to alter
>> the <toplevel>:decode/2 to return the remaining bytes and length from
>>  <snip>
> Hi
> It seems like the asn1 compiler option does most of what You want.
> From the docs
> "undec_rest
> A buffer that holds a message, beeing decoded may also have some
> following bytes.
> Now it is possible to get those following bytes returned together with
> the decoded value.
> If an asn1 spec is compiled with this option a tuple {ok,Value,Rest}
> is returned.
> Rest may be a list or a binary. Earlier versions of the compiler
> ignored those following
> bytes. "
Nice, thanks a lot Anders.

I will raise a bug report on the documentation now; this should be clear 
both in the asn1ct docs (which it is ~is, the options list doesn't 
mention it but the description does) and in the asn1rt docs (no mention 
of the alternative result). However at least this list discussion will 
serve to document this (and my oversight) for others in the future :-)

As an aside, has anyone noticed/looked at the UTF8 functions in the 
asn1rt module? I've not seen them mentioned in any of the Unicode 
discussions yet.


More information about the erlang-questions mailing list