YARG PDF report encoding issues

I have issues with cyrillic fonts when the same Java report builder code, source data and template file (DOCX) gives different results:

  1. Started in one host (Windows 10, Java 8, System locale/language - Russian), everything is fine, PDF is generated with correct font faces and encodings;
  2. Started on another host (also Windows 10, Java 8, also Russian system windows locale), as a result I see PDF with normal cyrillic letters from template, but variable placeholders are filled by letters in broken encoding. So I can understand that font used in PDF supports cyrillic.
    Additionally, when generating report, I see in console for a list of fonts:
    Aborting: file:/C:/WINDOWS/FONTS/ALGER.TTF (can’t get EmbedFontInfo[] … try deleting fop-fonts.cache?)
    How should I “delete fop-fonts.cache”?


Found here: http://www.docx4java.org/forums/docx-java-f6/can-t-get-embedfontinfo-try-deleting-fop-fonts-cache-t452.html that “delete fop-fonts.cache” means deleting file “%USERPROFILE%.fop\fop-fonts.cache”. Undortunately, this not helped.

Seems I found the issue source: when I read the JSON data using new String(Files.readAllBytes(Paths.get(“file.json”))); in different hosts seems default encoding differs: when I used new String(Files.readAllBytes(Paths.get(“file.json”)), StandardCharsets.UTF_8); everything went fine.