On Aug 25, 11:11 pm, JiaYanwei <[email protected]> wrote:
>
> e.g. If the system/vim encoding is 'UTF-8', but a text file encoding is
> 'latin-1'. If the default HTML charset is 'encoding', after ':TOhtml', we
> should change the HTML charset to 'iso-8859-1', or save the generated HTML
> file by ':w ++enc=utf-8'.

Hmm...unless I understand correctly, the sequence is:

Load text file. File encoding is latin-1, Vim encoding is utf-8.
Do :TOhtml to create a new html buffer. File encoding defaults to
empty, Vim encoding is still utf-8.
:TOhtml sees encoding and sets the charset in the generated markup to
UTF-8.
:w the new html buffer. Vim sees empty file encoding, so uses utf-8 as
the new file's encoding. Thus file encoding matches the html charset.

You claim that the new html buffer has "latin-1" encoding. Am I
missing something here?

I still think using fileencoding might be the "correct" way to do it,
but doing so would require 2html.vim to set the file encoding of the
new html buffer explicitly to be equal to the source file.

This also brings up another shortcoming of 2html, because using
g:html_use_encoding may change the html charset meta tag, but it does
NOT change the actual character encoding of the file. It looks like I
will need to set the fileencoding of the new html buffer to whatever
corresponds to the supplied user option as a separate fix.

Any thoughts?

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui