Commit 1496f13d08baa05c7be393938e29f9df7956f8df
1 parent
3c15e26a
xls_parser: Minor bugfix and doc addition
Showing
1 changed file
with
2 additions
and
1 deletions
oletools/xls_parser.py
| @@ -101,7 +101,7 @@ def read_unicode(data, start_idx, n_chars): | @@ -101,7 +101,7 @@ def read_unicode(data, start_idx, n_chars): | ||
| 101 | """ read a unicode string from a XLUnicodeStringNoCch structure """ | 101 | """ read a unicode string from a XLUnicodeStringNoCch structure """ |
| 102 | # first bit 0x0 --> only low-bytes are saved, all high bytes are 0 | 102 | # first bit 0x0 --> only low-bytes are saved, all high bytes are 0 |
| 103 | # first bit 0x1 --> 2 bytes per character | 103 | # first bit 0x1 --> 2 bytes per character |
| 104 | - low_bytes_only = (ord(data[start_idx]) == 0) | 104 | + low_bytes_only = (ord(data[start_idx:start_idx+1]) == 0) |
| 105 | if low_bytes_only: | 105 | if low_bytes_only: |
| 106 | end_idx = start_idx + 1 + n_chars | 106 | end_idx = start_idx + 1 + n_chars |
| 107 | return data[start_idx+1:end_idx].decode('ascii'), end_idx | 107 | return data[start_idx+1:end_idx].decode('ascii'), end_idx |
| @@ -349,6 +349,7 @@ class XlsRecordSupBook(XlsRecord): | @@ -349,6 +349,7 @@ class XlsRecordSupBook(XlsRecord): | ||
| 349 | LINK_TYPE_EXTERNAL = 'external workbook' | 349 | LINK_TYPE_EXTERNAL = 'external workbook' |
| 350 | 350 | ||
| 351 | def finish_constructing(self, _): | 351 | def finish_constructing(self, _): |
| 352 | + """Finish constructing this record; called at end of constructor.""" | ||
| 352 | # set defaults | 353 | # set defaults |
| 353 | self.ctab = None | 354 | self.ctab = None |
| 354 | self.cch = None | 355 | self.cch = None |