The BOM doesn't fall outside the Unicode range, it is not considered
part of the text, so when reading a file in ucs-bom mode, Vim strips the
BOM and sets the local 'bomb' option to remember that it must be added
back when writing the file.
To know if the current file has a BOM at its start, just use
if &bomb
You can't match it with a regex because it is not stored with the file's
data.
Best regards,
Tony.
--
What does it mean if there is no fortune for you?
>On 19/11/08 18:34, zod wrote:
>> Does the BOM fall outside of the unicode range that vim's regex
>> engine uses or do I just have the syntax wrong?
>The BOM doesn't fall outside the Unicode range, it is not considered
>part of the text [...]
Just for the record (and to be pedantic), while the BOM is a Unicode
character, the reversed BOM is not part of Unicode. This is more
a philosophical detail than a technical issue. :-)
--
François Pinard http://pinard.progiciels-bpi.ca
To be still more pedantic, U+FFFE is part of the Unicode range, where it
is listed as "Not a character", i.e., it is one of the "forbidden"
codepoints which are "in range". (The "original" Unicode range as still
supported by Vim for UTF-8, UTF-32be and UTF-32le, used to be from
U+0000 to U+7FFFFFFF. The Unicode Consortium later invalidated, among
others, (a) all planes above plane 0x10, and (b) the last two codepoints
U+xxFFFE and U+xxFFFF in every plane, which brings the highest "valid"
codepoint down to U+10FFFD at most.)
Best regards,
Tony.
--
His head smashed in, and his heart cut out,
And his liver removed, and his bowels unplugged,
And his nostrils raped, and his bottom burned off,
And his penis split ... and his ...
"Monty Python and the Holy Grail" PYTHON (MONTY)
PICTURES LTD