Skip to content

Surrogate characters are decoded wrongly in makeJustificationArray #605

@EmanuelCozariz

Description

@EmanuelCozariz

Given the following string 𧙗, this will be encoded as '\uD85D\uDE57'

The above string will be accepted by the font CODE2002.ttf

PDFont font = PDType0Font.load(doc, new File("CODE2002.ttf"));
cs.showText("\uD85D\uDE57");

But it is incorrectly decoded.

Method makeJustificationArray of PdfBoxFastOutputDevice
uses Character.toString(c) to add to the data array

uD85D => Character.toString(c) will decode as �
uDE57 => Character.toString(c) will decode as �

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