[
https://issues.apache.org/jira/browse/PDFBOX-2798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14542778#comment-14542778
]
John Hewson edited comment on PDFBOX-2798 at 5/13/15 9:40 PM:
--------------------------------------------------------------
There's another problem with PDTextStream, 8-bit encoded text should be treated
as having PDFDocEncoding, however we see this line:
{quote}
return new String(out.toByteArray(), "ISO-8859-1");
{quote}
Note that ISO-8859-1 is essentially WinAnsiEncoding. PDTextStream is looking
pretty questionable to me, first of all it doesn't actually represent a "text
stream" but "a text string or a text stream", secondly it would be far simpler
to just use COSString given that getAsStream() is never actually called.
was (Author: jahewson):
There's another problem with PDTextStream, 8-bit encoded text should be treated
as having PDFDocEncoding, however we see this line:
{quote}
return new String(out.toByteArray(), "ISO-8859-1");
{quote}
Note that ISO-8859-1 is essentially WinAnsiEncoding. PDTextStream is looking
pretty questionable to me, first of all it doesn't actually represent a "text
stream" but "a text string or a text stream", secondly it would be better to us
COSString given that getAsStream() is never actually called.
> PDTextStream does not support UTF16 with BOM
> --------------------------------------------
>
> Key: PDFBOX-2798
> URL: https://issues.apache.org/jira/browse/PDFBOX-2798
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 1.8.10, 2.0.0
> Reporter: Michele Balistreri
> Attachments: PDTextStream-UTF16.diff
>
>
> the getAsString() method from PDTextStream is quite useful, but it does not
> support UTF-16 text. I added a small check on the first two bytes to support
> UTF-16 content. This is needed because two-bytes encodings do not degrade
> gracefully like UTF-8, even for plain ASCII text and so the resulting string
> is unusable.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]