TransWikia.com

Unicode in PDF metadata with latex3 and an utf8 engine

TeX - LaTeX Asked by Callegar on October 26, 2020

In Unicode in PDF Metadata, Heiko Oberdiek proposes a way to set the PDF metadata to some unicode string while operating at the low level, without resorting to hyperref. To this aim, he ends up using the stringenc package to do the necessary re-encoding of the string from utf-8 to utf-16be and he needs to manually add a BOM. Here is his example:

% UTF-8 encoded source file
input stringenc.styrelax

defMyAuthor{Erwin Schrödinger}
edefBOM{string376string377}
StringEncodingConvert{PdfAuthor}{MyAuthor}{utf8}{utf16be}
StringEncodingSuccessFailure{}{%
  errmessage{Conversion from utf8 to utf16be failed for author string}%
}
pdfinfo{/Author(BOMpdfescapestring{PdfAuthor})}%
null
bye

I wonder if there is a way to do the same without having to resort to stringenc, but relying on the latex3 interfaces. I have seen that there is a whole latex3 package for string encoding conversions, that is l3str-convertpackage. However, I cannot find anything strightforwardly doing what I need. For instance, is there a pre-made BOM definition for PDF metadata? Should I rely on str_set_convert:Nnnn to do the conversion (possibly with a :NVnn variant?). Is there an all-in one function doing the conversion for me? str_convert_pdfname:n is certainly not what I am looking for, right?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP