Thanks to Larry Cai <larry.caiyu@gmail.com> for pointing this out:
On Thu, Feb 09, 2012 at 03:25:09PM +0800, Larry Cai wrote:
> …
> When I just remove "[:-len('�')]", it seem works!!
> …
I had thought that pdftk always appended a trailing null byte to
Unicode strings, but that appears to be incorrect.
... 'BookmarkTitle: Section 1.1.2',
... 'BookmarkLevel: 3',
... 'BookmarkPageNumber: 4',
- ... 'BookmarkTitle: αβγ�',
+ ... 'BookmarkTitle: αβγ',
... 'BookmarkLevel: 4',
... 'BookmarkPageNumber: 4',
... 'BookmarkTitle: Section 1.2',
value = int(value)
elif k == 'title':
if self._UNICODE_REGEXP.search(value):
- value = self._unicode_replace(value[:-len('�')])
+ value = self._unicode_replace(value)
else:
value = unicode(value)
bookmark_info[k] = value