Hans Hagen wrote:
>
> On 3/17/2021 5:30 PM, Andreas Matthias wrote:
> > I'm having a hard time with pdfe.getstring(). What am I supposed to do if it
> > returns an UTF-16 encoded string? How to convert it to UTF-8?
>
>    contents = annot.Contents
>    local t = { }
>    for c in string.gmatch(contents,".") do
>        t[#t+1] = string.format("%02X",string.byte(c))
>    end
>    contents = table.concat(t)
>    local str = '/Subtype/Text/Contents <' .. contents .. '>'

Thank you!

I was pondering on using a unicode library and didn't even think about
hex encoding.
But conversion to hex is definitely much easier and doesn't require
any third party
library.

Andreas

Reply via email to