Thursday, November 29, 2012

Re: Automatically change encoding when opening file

On Thu, Nov 15, 2012 at 8:31 AM, Tony Mechelynck
<antoine.mechelynck@gmail.com> wrote:

>
> If a file in UTF-16le has a BOM (the codepoint U+FEFF at the very beginning
> of the file, which for UTF-16le means the bytes 0xFF 0xFE), then if you have
> set Vim to use UTF-8 'encoding' in your vimrc that file will usually be
> opened correctly (because the default 'fileencodings' -plural- starts with
> "ucs-bom"). See http://vim.wikia.com/wiki/Working_with_Unicode about how to
> set Vim up like that.
>

Hi Antoine,

I'm not really that familiar with the different encoding types (UTF-8,
UTF-16, etc), but when I came across a strange <feff> character which
I think is related to what you're describing.
I open up two files in gedit and they seem to contain the same exact
line. But in vim, there's a strange character at the beginning
"<feff>". It's not a string, because if I go to the beginning of the
line and hit 'x', it deletes the entire <feff>, indicating it's some
sort of special hidden character.
What is this strange character? In Vi's hex mode (%!xxd), I can see
there is a sequence of bits "efbbbf", and the rest of the file seems
to somehow be offset

Thanks,
Ven



>
> Best regards,
> Tony.
> --

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