Skip to content

Instantly share code, notes, and snippets.

@cpylua
Created April 13, 2011 11:06
Show Gist options
  • Save cpylua/917364 to your computer and use it in GitHub Desktop.
Save cpylua/917364 to your computer and use it in GitHub Desktop.
" If TOhtml is unavailable or the wrong version, at least handle some
" canonical encoding names in Vim.
elseif nenc =~ 'iso[-_]8859-1'
return 'latin1'
elseif nenc =~ 'iso[-_]8859-2'
return 'latin2'
elseif necn ==? 'gb2312' " necn should be nenc
return 'cp936' " GB2312 imprecisely means CP936 in HTML
elseif nenc =~ '\(cp\|win\(dows\)\?\)-125\d'
return 'cp125'.nenc[strlen(nenc)-1]
elseif nenc == 'utf8'
return 'utf-8'
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment