[poppler] poppler::ustring encoding issue

Adam Reichold adam.reichold at t-online.de
Tue Mar 6 19:00:03 UTC 2018


Hello Jeroen,

Am 06.03.2018 um 12:59 schrieb Jeroen Ooms:
> On Tue, Mar 6, 2018 at 10:31 AM, Adam Reichold
> <adam.reichold at t-online.de> wrote:
>> Hello mpsuzuki,
>>
>> from a glance at the code, it seems page::text uses ustring::from_utf8
>> to convert Poppler's GooString into ustring which seems correct if
>> GlobalParams::textEncoding has its default value of "UTF-8" .
> 
> I don't understand this part. Why is textEncoding a global property?
> Shouldn't this be a property of single pdf document? Is there some way
> I can read a document's encoding from the C++ api (without including
> GlobalParams.h).
> 
> The pdf spec states that different strings may have different
> encodings. Perhaps it would be possible to expose an encoding field in
> the ustring class? If there would be a way to know the encoding of a
> ustring, I can get the raw data and convert it to a suitable encoding
> myself. This would be much better than making assumptions.

This is not the encoding of the text in the PDF document, but the
encoding of the GooString that are returned by the internal Poppler API.
Also I think the ustring class is intended to always store UTF-16
encoded data.

Best regards, Adam.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 525 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/poppler/attachments/20180306/f5d62880/attachment.sig>


More information about the poppler mailing list