[Answer]-Python – unpack using struct in Django

1👍

You have a unicode string of length 12 (unicode characters). struct needs a binary string of 12 bytes length.

You started with a binary string in your C code, so you need to work out how it has been decoded to unicode, so that you can reverse the operation, or work out how to get the original binary string from django.

Also you might want to define your C structure in terms of fixed size types ( uint64_t etc) so that you don’t have problems on different platforms.

Leave a comment