Thursday, May 6, 2010

RE: Detect file encoding

Charles Campbell wrote:
>> 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
>> ...
>
> 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.

Thanks, but please boldly say what you think about the idea of using
Vim to detect the file encoding. Is it a worthwhile tip, or is it
fundamentally misguided because all it is doing is using the user's
predefined list in 'fileencodings'?

John

--
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: