views:

208

answers:

3

Hi,

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

A: 

Make sure your printer supports printing unicode characters. Try updating your drivers and going into the settings and turning on truetype fonts for printing or a similar option. As far as I know, Courier uses ASCII.

Typing :h printencoding turns up:

If 'printencoding' is empty or VIM cannot find the file then it will use 'encoding' (if VIM is compiled with |+multi_byte| and it is set an 8-bit encoding) to find the print character encoding file. If VIM is unable to find a character encoding file then it will use the "latin1" print character encoding file. When 'encoding' is set to a multi-byte encoding, VIM will try to convert characters to the printing encoding for printing (if 'printencoding' is empty then the conversion will be to latin1). Conversion to a printing encoding other than latin1 will require VIM to be compiled with the |+iconv| feature. If no conversion is possible then printing will fail. Any characters that cannot be converted will be replaced with upside down question marks. Four print character encoding files are provided to support default Mac, VMS, HPUX, and EBCDIC character encodings and are used by default on these platforms. Code page 1252 print character encoding is used by default on Windows and OS/2 platforms.

rkulla
A: 

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.

Mephi_stofel
A: 

I will try it. It looks that only u2ps from GNOME gnome-u2ps package (Ubuntu) understands UTF-8 input and creates correct postscript output.

Milan Leszkow