Is there a solution to printing unicode characters from gvim?

See this:

enter image description here

Results in this print result

enter image description here

(Using a Linux setup and Vim 8.0.)

  • 2
    It looks like your printing setup expects a different character set, or doesn't support unicode at all Apr 11, 2017 at 19:59
  • What do you get from :set enc? fenc? penc? (as one command)
    – Amadan
    Apr 12, 2017 at 4:17
  • In the example above, where I did not save to a file, I get: encoding=utf-8 fileencoding= printencoding= Apr 12, 2017 at 9:26
  • If I execute set penc=utf8 the problem in the printed output persists. Apr 12, 2017 at 9:27

3 Answers 3


Per this Stackoverflow:4586628 Q/A, How do you pipe a vim buffer through lpr?, I have this entry in my ~/.vimrc:

nmap PpP :%w !lpr -o lpi=8 -o cpi=14<CR><CR>

that replaces my old entry,

nmap PpP :ha<CR>

(:ha = :hardcopy).

Using :ha, Neovim was not printing Greek letters, ... even though my (Arch Linux) locale was


and I have this line, near the top of my ~/.vimrc,

scriptencoding utf-8

[Printing is system-dependent, not vim-dependent.]

I added the lpi (lines-per-inch) and cpi (characters-per-inch) to jiggle my font size to that similar to as what I was getting with the :ha command (I measured/counted with an actual ruler), and run it as a PpP command/shortcut, added to my ~/.vimrc, whenever I want to print the current buffer.


Send the buffer to the browser by converting to HTML, then print from there:

:TOhtml | w | !open -a Safari %

For example I have this in vim: enter image description here

If I type


I get this: enter image description here

But when I send it to the browser I get this (with color scheme!):

enter image description here

I have this in my .vimrc, which deletes the new html buffer and stored file:

nnoremap <F2> <ESC> :TOhtml <bar> w <bar> !open -a Safari % <CR> <bar> ZQ <CR> <bar> execute '!rm %:p.html' <CR>

Vim seems to produce fairly simple PostScript through the :hardcopy command. PostScript itself has no understanding of Unicode, and so having it render "special characters" properly is a complicated process involving intimate knowledge of fonts, etc.

I filed a bug about this, FWIW: https://github.com/vim/vim/issues/8935

I the meantime, I think the best solution is to use an external program to produce your printable output. For instance paps (link) converts UTF-8 text to PostScript. You can, of course, run this external program from inside Vim using your own command, as described in another answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.