Skip to content

Fail to read a text object #37

@tdiwasa

Description

@tdiwasa

readStringFromStream() fails to create a string object
if a text object like below was given.

BT 1 0 0 1 0 1.9 Tm /F3+0 8.6 Tf 10.5 TL (\376\377 ) Tj T* ET

readStringFromStream() decodes (\376\377 ) to a string '\xfe\xff\x20'.

createStringObject() checks first 2 bytes of the string,
and will attempt to decode with UTF-16.
Then an exception will be raised because '\x20' is illegal as UTF-16.

Apparently, a text "\376\377" should not be treated as BOM.

BOM check would be a conformance of "Text Strings" described in PDF Reference,
but it should be applied only to the "text string" type item specified in PDF Reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions