Skip to content

Commit 7c68330

Browse files
Add backup method for determining strings unicode
1 parent 2ee860e commit 7c68330

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

extract_msg/msg_classes/msg.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,16 @@ def areStringsUnicode(self) -> bool:
843843
"""
844844
Whether the strings are Unicode encoded or not.
845845
"""
846-
return (self.getPropertyVal('340D0003', 0) & 0x40000) != 0
846+
val = self.getPropertyVal('340D0003', None)
847+
if val is None:
848+
# Try to get this value from the parent.
849+
if self.prefix:
850+
if self.__parentMsg and (msg := self.__parentMsg()) is not None:
851+
return msg.areStringsUnicode
852+
853+
# Final attempt: check the actual streams.
854+
return any(x[-1].upper().endswith('001F') for x in self.listDir())
855+
return (val & 0x40000) != 0
847856

848857
@functools.cached_property
849858
def attachments(self) -> Union[List[AttachmentBase], List[SignedAttachment]]:

0 commit comments

Comments
 (0)