-->

decoding asn.1 compiler output as strings

2019-09-18 19:49发布

问题:

I ran the free online compiler (at http://lionet.info/asn1c/asn1c.cgi) and created source files for the IMSRecord (telecom CDR).

It built okay, but when I run the generated C executable, it prints the strings as hex characters, as follows: sIP-Method: 49 4E 56 49 54 45

How can I get it to print as

sIP-Method: INVITE

I tried the various command-line options, but could not get it to change.

Is this perhaps related to one of the online compiler options that I probably did not understand at the time?

Thanks,

Mitch

回答1:

The OCTET STRING type is not supposed to be printable. Therefore the asn1c prints out the hexadecimal dump of this bunch of bytes. If you want a readable output, I suggest replacing OCTET STRING with something like IA5String or UTF8String, depending on the kind of encoding you think this OCTET STRING bears. This is your choice and asn1c can't make this choice automatically because it can't expect a particular encoding.



标签: asn.1