I have problem with printing to postscript from Vim.
I'm, using utf-8 encoding with czech characters like 'ščřž' but in the output I get upside question mark instead of the correct characters.
vim --version
VIM - Vi IMproved 7.2
+iconv +multi_byte +postscript
printer settings:
set printoptions=paper:A4,duplex:off,collate:n,syntax:n
printer font: courier
Rkulla, that's wrong. As regards your message, I've understood that if we don't set 'printencoding' vim will convert our message (utf-8) to 'latin1' and because of that we have problems. I think that's not true.
I printed file (with Cyrillic symbols) in vim with printencoding=utf-8 by :hardcopy I also get reverse question mark instead of the correct symbols. My settings: 1) printfont = utf-8 2) encoding = utf-8 3) fileencoding = utf-8. I think problem in PostScript. If you try to print something (for example with Cyrillic symbols) in console/terminal (not GUI) by lp/lpr you will get incorrect symbols (in place where Cyrillic). That's conversion problems from non-ASCII text to PostScript in terminal. Vim use printexpr and has default: printexpr=system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error. I don't know how to fix that. I read that's general Unix/Linux problems. But you should try rewrite printexpr for using a2ps, enscript or similar.
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:
If I type
:ha
I get this:
But when I send it to the browser I get this (with color scheme!):
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With