> I need helping deciding whether the following is a useful tip:
> http://vim.wikia.com/wiki/Bash_file_encoding_alias
>
> The heart of the matter is that the tip claims it can use Vim
> (on Linux) as a quick way to determine the file encoding of a
> particular file. It uses this bash alias (one line):
>
> alias vimenc='vim -c '\''let $enc = &fileencoding | execute "!echo Encoding: $enc" | q'\'''
>
> A usage example is as follows (at bash prompt):
>
> $ vimenc UTF-16.xml
> Encoding: utf-16le
> Press ENTER or type command to continue
>
> I don't understand this. Surely all Vim does is look through
> whatever 'fileencodings' you have configured, and take the first
> which gives no character encoding errors?
>
> If my understanding is correct, wouldn't the tip require the
> user to have made a decision in advance regarding what the user
> wants to regard as the "correct" encoding? Since the tip does
> not mention 'fileencodings', is the tip worth keeping?
>
> While there are no certain ways to detect file encodings, surely
> Linux has some more standard tool?
>
Under linux, the "file" utility identifies the encoding, but it also
adds additional information. The following website
http://codesnipers.com/?q=node/68 has a nice discussion about
determining encoding.
HTH,
Chip Campbell
--
You received this message from the "vim_use" 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
No comments:
Post a Comment