简体   繁体   English

在非多字节Vim中正确显示utf-8 HTML字符

[英]Properly display utf-8 HTML characters in non-multibyte Vim

I've been attempting to open .epub files in vim for reading (yes it's silly, let's ignore that for now) and I'm having trouble with how the internal html of epubs displays characters such as ' and " among other things. 我一直试图在vim中打开.epub文件以进行阅读(是的,这很愚蠢,让我们暂时忽略它),而epubs的内部html如何显示诸如'和'之类的字符时遇到了麻烦。

Vim displays ' as â~@~Y while opening the file with less gives me <E2><80><99> . Vim在显示文件时少显示' <E2><80><99>显示为' â~@~Y I'm not sure how vim deals with this (it seems to treat ~@ and ~Y as single characters) and as such I'm not sure how to go about replacing the special HTML characters with their utf-8 equivalent. 我不确定vim如何处理这个问题(它似乎将~@~Y视为单个字符),因此我不确定如何用其utf-8等效字符替换特殊的HTML字符。

Is there a encoding setting that will display this properly? 是否有编码设置可以正确显示? Or a way to manually input these characters such that I could create a search and replace macro? 还是一种手动输入这些字符的方式,以便我可以创建搜索并替换宏?

Thanks 谢谢

It looks like Vim doesn't properly detect the UTF-8 encoding; 看来Vim无法正确检测到UTF-8编码。 you can check with 你可以检查

:setlocal fileencoding?

and force UTF-8 with 然后用

:edit ++enc=utf-8 file.epub

(or tweak your 'fileencodings' option to have it automatically detected). (或调整'fileencodings'选项以使其自动检测到)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM