def ENCODED_STRING__setitem__(self, key, value): if key == 'Character' and isinstance(value, unicode): value = value.encode('utf-16le') Structure.__setitem__(self, 'Encoded_String_Flag', 0x1) self.structure = self.tunicode self.isUnicode = True Structure.__setitem__(self, key, value)