Tuesday, August 9, 2011

Re: How to display and remove BOM in utf-8 encoded file

On 9 August 2011 17:13, Tony Mechelynck <antoine.mechelynck@gmail.com> wrote:

> That message is outdated. The BOM is supported in all Unicode encodings
> including UTF-8 by all "reasonably recent" browers. It is also part of the
> HTML standard.

Well, with the BOM the whole layout of the website appeared broken in
Internet Explorer 7. No problem with Firefox. Still it seems is not an
issue to understimate.

> For some other kinds of text files (most source files and shell scripts, for
> instance), it is better to save the file without a BOM, but for momst "web"
> formats including HTML, CSS, and, I think, XML, XHTML, etc., a BOM is no
> problem and can even be a help (e.g. in case the web server sets the charset
> incorrectly or not at all in its Content-Type header).

It was a php file, so maybe that's problem.

> To save the file without a BOM:
>
>        :setlocal nobomb
>        :w
>
> To ask Vim if there is a BOM:
>
>        :setlocal bomb?
>
> The answer is bomb for "BOM present" or nobomb for "BOM absent".
>
>
> To display the presence or absence of the BOM on the status line:
>
>        see
> http://vim.wikia.com/wiki/Show_fileencoding_and_bomb_in_the_status_line

Thanks for all the info and the commands. Very useful.

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