decoding asn.1 compiler output as strings

点点圈 提交于 2019-12-12 02:36:00

问题


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.



来源:https://stackoverflow.com/questions/12141250/decoding-asn-1-compiler-output-as-strings

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!