Matthew Winn wrote:
> On Sun, 18 May 2008 11:10:53 +1000, "John Beckett"
> <[EMAIL PROTECTED]> wrote:
> 
>> Adri Verhoef wrote:
>>> I think there is a problem here, namely that the BOM (Byte 
>>> Order Mark, see :help 'bomb') is transferred to the shell 
>>> command, when it shouldn't.  In my opinion Vim should be able 
>>> to temporarily remove the BOM, then execute the shell 
>>> command, and finally place the BOM back at its original 
>>> place, at the beginning of the file.
>> I can't follow the logic of that. If a BOM is requested, then it will be 
>> inserted if
>> the file is saved. Sending it to an external program requires that the file 
>> be
>> saved, and the whole point of the BOM is to tell the external program what 
>> encoding
>> to use.
> 
> It's not quite that simple. I can't do any testing at the moment, but
> what happens when a part of the file not including the first line of
> the buffer is filtered through an external command? Should the BOM be
> added to the start of the filtered text and removed afterwards?
> 
> I suppose it all depends on whether the BOM is considered to be part
> of the buffer or part of the file.

I think the BOM should be considered part of the encoding and thus output 
regardless of which lines of the file are sent to the filter.

(Likewise, I think endofline is much the same and if not set, the last EOL 
should 
be omitted whichever lines are sent to a filter, too, but that's another story, 
and Bram disagrees with me on that one, I think.)

Vim has the flexibility of saving files and sending them to filters in any 
encoding you choose, with or without a BOM, by setting fileencoding and bomb 
options, and I think this behaviour should be kept. If you want to pipe your 
data 
through a filter that doesn't understand BOM, set nobomb. If you don't want a 
BOM 
ending up in your text when it is read back in after filtering (i.e. when a 
filter 
outputs a valid BOM at the beginning of its output), set fileencodings (note 
the 
S) appropriately. Likewise, if you have a filter that only deals with Latin1 or 
cp1252 or whatever and not Unicode, set the options appropriately when using 
that 
filter (yes, this is a muckaround, but Vim doesn't know what every external 
filter 
needs so can't do this automatically).

Ben.





--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui