Vim 中的中欧字符并打印(PDF)它们 [英] Central european characters in Vim and printing (PDFing) them out

查看:21
本文介绍了Vim 中的中欧字符并打印(PDF)它们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试说服 GVim 7.3 将 (:hardcopy) 中欧字符 (šđčćž ŠĐČĆŽ) 正确打印到 PDF.我认为相关的设置

I'm trying to persuade GVim 7.3 to correctly print (:hardcopy) central european characters (šđčćž ŠĐČĆŽ) to PDF. Settings which I believe to be relevant

set encoding=utf8
set fileencodings=ucs-bom,utf8,cp1250,latin1
set guifont=Consolas:h9:cEASTEUROPE
set printfont=Consolas:h9:cEASTEUROPE

在将编码更改为 cp1250 后(并再次编写它们,因为编码的更改搞砸了)它们正确打印出来.

After changing the encoding to cp1250 (and writing them again, since the change in encoding screws the up) they print out correctly.

现在,我认为 utf-8 比 cp1250 更大更完整.为什么在更改之后它们会正确打印出来,或者更重要的是,为什么我不能将它们与 enc=utf-8(我通常使用它,因为其他字符很多,通常无法访问)结合使用)?

Now, I thought utf-8 was a much bigger and more complete set than cp1250. Why after that change they correctly print out, or more importantly, why I can't use them in combination with enc=utf-8(which I normally use because of abundance of other characters, not normally accessible)?

:version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Oct 27 2010 17:59:02)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1-46
Compiled by Bram@KIBAALE
Big version with GUI.  Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent +clientserver +clipboard +cmdline_compl
+cmdline_hist +cmdline_info +comments +conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con_gui +diff +digraphs -dnd
-ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +float +folding -footer +gettext/dyn
-hangul_input +iconv/dyn +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap -lua +menu
 +mksession +modify_fname +mouse +mouseshape +multi_byte_ime/dyn +multi_lang -mzscheme +netbeans_intg +ole -osfiletype
+path_extra +perl/dyn +persistent_undo -postscript +printer -profile +python/dyn +python3/dyn +quickfix +reltime +rightleft
+ruby/dyn +scrollbind +signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary +tag_old_static
-tag_any_white +tcl/dyn -tgetent -termresponse +textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual
+visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup -xfontset -xim -xterm_save +xpm_w32
   system vimrc file: "$VIMvimrc"
     user vimrc file: "$HOME\_vimrc"
 2nd user vimrc file: "$VIM\_vimrc"
      user exrc file: "$HOME\_exrc"
  2nd user exrc file: "$VIM\_exrc"
  system gvimrc file: "$VIMgvimrc"
    user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$VIM\_gvimrc"
    system menu file: "$VIMRUNTIMEmenu.vim"
Compilation: cl -c /W3 /nologo  -I. -Iproto -DHAVE_PATHDEF -DWIN32   -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG   -DFEAT_XPM_W32   -DWINVE
R=0x0400 -D_WIN32_WINNT=0x0400  /Fo.ObjGOLYHTR/ /Ox /GL -DNDEBUG  /Zl /MT -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_W3
2 -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL="tcl83.dll" -DDYNAMIC_TCL_VER="8.3" -DFEAT_PYTH
ON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL="python27.dll" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL="python31.dll"
-DFEAT_PERL -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL="perl512.dll" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=191 -DDYNAMIC_RUBY_DLL
="msvcrt-ruby191.dll" -DFEAT_BIG /Fd.ObjGOLYHTR/ /Zi
Linking: link /RELEASE /nologo /subsystem:windows /LTCG:STATUS oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib  comdl
g32.lib ole32.lib uuid.lib /machine:i386 /nodefaultlib gdi32.lib version.lib   winspool.lib comctl32.lib advapi32.lib shell32.lib
 /machine:i386 /nodefaultlib libcmt.lib oleaut32.lib  user32.lib      /nodefaultlib:python27.lib /nodefaultlib:python31.lib   e:	
cllib	clstub83.lib WSock32.lib e:xpmliblibXpm.lib /PDB:gvim.pdb -debug
Press ENTER or type command to continue

<小时>

使用 enc=utf8 输入和保存时:


When typed and saved with enc=utf8:

0000000: c5a1 2020 2020 c5a0 0d0a c491 2020 2020  ..    ......    
0000010: c490 0d0a c48d 2020 2020 c48c 0d0a c487  ......    ......
0000020: 2020 2020 c486 0d0a c5be 2020 2020 c5bd      ......    ..
0000030: 0d0a 0d0a 0d0a                           ......

... 使用 enc=cp1250

... with enc=cp1250

0000000: 9a20 2020 208a 0d0a f020 2020 20d0 0d0a  .    ....    ...
0000010: e820 2020 20c8 0d0a e620 2020 20c6 0d0a  .    ....    ...
0000020: 9e20 2020 208e 0d0a 0d0a                 .    .....

推荐答案

这里有一个 非常好的话题 讨论了与此非常接近的内容.最后的结论是,它不起作用,不要那样做"——只需将文件保存在 UTF-8 中,然后用其他东西打印出来,例如记事本.

Here's a very nice thread discussing something very close to this. The conclusion at the end is, "it doesn't work, don't do that" -- just save the file in UTF-8 and print it with something else, e.g. notepad.

这适用于我的系统:

:silent !notepad /pt "%" "PDFLite"

其中 PDFLite 是我的打印到 PDF 打印机的名称.

where PDFLite is the name of my print-to-PDF printer.

编辑:我在 vim 中使用utf-8"编码.

Edit: I'm using the "utf-8" encoding in vim.

这篇关于Vim 中的中欧字符并打印(PDF)它们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆