'wkhtmltopdf pass cyrillic value to --header parameter

I am using wkhtmltopdf.exe command line tool to render HTML into PDF.

I try to generate PDF with custom header using cyrillic symbols. So I have cmd command like this:

wkhtmltopdf.exe --header-center "Заказ в Австралию — Test" http://localhost/MyPage c:/1.pdf

The issue is that in generated PDF the header looks like this: "?????? ? ??????? - Test"

I tried to add parameter --encoding utf-8 but this not worked for me

Note that my pc is running Windows with the only installed English (US) system locale.

Is there any thoughts how to solve this issue without installing any other system locale?



Solution 1:[1]

Old topic but hope my solution will help someone. Here is what helped me (used good clue from lit comment above) :

  1. created .bat file with text like this: chcp 65001 C:\data\wkhtmltopdf.exe --footer-font-size "10" --footer-center "???????? [page] ? [topage]" file:///C:\data\12345.html C:\data\12345.pdf
  2. for my server side solution I called ProcessStartInfo for FileName="cmd" and Arguments= "/c "+batchfile This did the job. BUT - you still need to make sure that server is switched to your language for non-Unicode chars.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sorvik