This thread discusses it, and I eventually included an initial beta
version that does exactly this:
http://groups.google.com/group/vim_dev/browse_thread/thread/c41f797237e46f45
Also included is detection of the proper 'fileencoding' from the
user-specified HTML encoding, if given.
I have not received any feedback on the initial release, but I have
acted on my musings and created a second beta version that removes
specific encodings from the automatic detection, which are not
supported on all 5 major browsers, according to
http://wiki.whatwg.org/wiki/Web_Encodings.
Please try it out and send me any comments! See attached patch against
the current latest Vim (Mercurial changeset fae782ef63dd), or go to
http://code.google.com/p/vim-2html-test/downloads/list for the fully
patched files. Most users should not notice any differences, unless
they had specific encoding-related problems in the past, in which case
hopefully the updates solve more problems than they create.
One thing in particular I'd like to know, is it worthwhile to provide
platform-specific code, that adds additional encodings based on your
system? For example, Windows users might like windows-1252 detected
automatically by default. Is there a good way to figure out what the
supported encodings are for a given system? Maybe, code like this
would be better as a separately distributed plugin, since most users
can probably just use UTF-8 with no problems.
Oops, found one bug, where converting to UTF-8 for all Unicode
encodings did not also convert the fencoding.
Here's an updated patch. New fully-patched files also have been
uploaded as indicated above.
I'll probably give it about another week to collect comments before
submitting to Bram if there are no issues.
I haven't received any comments yet. Has anyone had a chance to try
this, or at least look at the :help updates for usability, usefulness,
and/or correctness?
I still have not received any comments, but I think it is ready. I am
currently working on a separate plugin to submit to vim.org which uses
the new options to automatically add all the installed codepages on
Windows to the auto-detection. I was going to use this for a further
test, but I have already updated my test suite and ran it on the new
code with good results. I will send you the updated files either
tonight or tomorrow night.
The extra plugin I'm making to add Windows codepages might be very
useful to any Windows users who use TOhtml a lot with uncommon
encodings. Do you think the plugin should be mentioned in the :help?
I also wanted to make a plugin for Unix systems, but iconv --list
apparently returns results in a "system-dependent format". Is there a
good way to get all available encodings on a Unix system? On Windows
I'm doing a glob() for c_*.nls files in the System32 directory.