# [Dev-luatex] Unicode in \pdfinfo

Hans Hagen pragma at wxs.nl
Sat Jun 28 13:46:17 CEST 2008

```Khaled Hosny wrote:
> On Fri, Jun 27, 2008 at 11:49:07PM +0200, Hans Hagen wrote:
>> Khaled Hosny wrote:
>>> \pdfinfo doesn't seem to support Unicode, when I compile the attached
>>> example with luatex I get symbols like Ù‡ØµØ© instead of the proper
>>> (Arabic) Unicode strings.
>>> Shouldn't luatex default to Unicode here too?
>> this is a backend c.q macro package issue ... (btw this can also be done
>>  in pdftex, but i never came to enabling the code in context because
>> there was nothign to test)
>
> I suspected that, since hyperrref with latex does this, but I found that
> xetex supports Unicode pdfinfo directly and thought luatex should do
> this too.

in luatex eventually we will have a more generic backend concept and try
to minimize the number of specific primitives

for instance, at some point we will have something pdf.info being a lua
table (representing a dictionary) and then one sets lua strings and
these are just sequences of bytes; this is why a helper makes more sense

pdf.info.title =
string.utf8valueto16be(0xFEFF) ..
string.utf8toutf16be(somestring)

in the meantime such helpers could also be used in the regular \pdfinfo

as taco mentioned, xetex is a different animal .. ok, there could be a
primitive doing the conversion, but there the pdf support is drivven by
the dvipdfmx backend; also, keep in mind that in practice there are many
more places where strings shos up (e.g. in user annotations) and not
every string is representing text

(currently in context i use hex strings instead)

Hans

-----------------------------------------------------------------