midstar / pycstruct

A python library for reading and writing binary data similar to what is done in C language structs
MIT License
23 stars 4 forks source link

utf-8 type criteria too strict #11

Closed aczcoetzee closed 3 years ago

aczcoetzee commented 3 years ago

The _CastXmlParser._fundamental_type_to_pcstruct_type() method assumes any char array is utf-8 and this ultimately results in a StringDef type for the character array.

This may not always be the case - sometimes you may have arrays of normal unsigned 8-bit integers for example.

Consider changing the criteria such that only an array of char is assumed to be utf-8. This will result in arrays of unsigned char and signed char to be treated as arrays of uint8 and int8 respectively.

midstar commented 3 years ago

Good idea. I will have a look at this.

midstar commented 3 years ago

This feature request has now been implemented in pycstruct 0.5.0.