Strings are currently decoded immediately after they are read. This causes issues since a string that does not fit the proposed encoding scheme will cause the program to crash.
Losing the encoding does however cause annoyances. Instead, the dynamic typing of Python should be exploited and:
If a string is successfully decoded, the string is stored as a string.
If a string fails to decode, it is stored as a bytestring.
On import to Blender, the type of the string can then be checked:
If it is str, the name is imported normally.
If it is bytes, the name is used by replacing erroneous parts of the string with placeholder characters, and the raw bytestring is loaded into the override_name.
To complete this feature, the override_name will need to be changed to a BYTE_STRING subtype, and all strings loaded into override_name should be converted to bytes. Code using the override_name will then need to be adjusted to account for this.
Strings are currently decoded immediately after they are read. This causes issues since a string that does not fit the proposed encoding scheme will cause the program to crash.
Losing the encoding does however cause annoyances. Instead, the dynamic typing of Python should be exploited and:
On import to Blender, the type of the string can then be checked:
str
, the name is imported normally.bytes
, the name is used by replacing erroneous parts of the string with placeholder characters, and the raw bytestring is loaded into theoverride_name
.To complete this feature, the
override_name
will need to be changed to a BYTE_STRING subtype, and all strings loaded intooverride_name
should be converted to bytes. Code using theoverride_name
will then need to be adjusted to account for this.