11 09 2010

VIM remove BOM

bigCat Posted in Linux - Comment.isBlank

>I use utf8, and I would like to know how to save a file with BOM\r\n>1. always added\r\n>2. always removed\r\n>3. unchanged\r\n>and what is the default behaviour of vim?\r\n\r\nRarely if ever poke utf8 files (usually find the weirdo chars and turn\r\n'em into named entities instead), but iirr, forcing a BOM is done with\r\n\r\n :set bomb\r\n\r\nforcing it off with\r\n\r\n :set nobomb\r\n\r\nand the default behavior is whatever the file has when you start to edit\r\nit, with or without.\r\n\r\nIirr, any nonascii utf8 char (>1byte) will normally force the BOM to be\r\nturned on. Might be wrong, though, and it might assume/require\r\nlittle-endian multibyte chars per the utf8 spec (ie, a BOM would be\r\nredundant), and iirr the BOM is only really required with utf16/ucs2\r\nencoding.\r\n\r\nTony M's the one to ask, though. :D\r\n\r\n\r\nThen again, there's always\r\n\r\n :help bomb\r\n\r\netc. Lis, haven't poked around with this kind of thing but on rare\r\noccasion.\r\n

Host: (miao) | Word: Press | Code: HTML5