to dir
vim: file encoding, bomb, and that  thing
rev 23 oct 2022
Category: editors - vim
» file encoding↓ bom↓  ↓ links↓
.........................
✶ file encoding:
; to see:
:set fileencoding
; to change:
: set fileencoding utf-8
.........................
✶ BOM - Byte Order Mark:
; to see:
:set bomb?
; to set on:
:set bomb
; to set off:
:set nobomb
You don't usually need the BOM.
But - if you want to display extended unicode
characters in a .txt file in the browser, you need it.
"I've noticed that the shebang on the first line of
executable scripts is not recognized if there is a bomb, ..."
-- http://vim.1045645.n5.nabble.com/Is-it-a-good-practice-to-setlocal-bomb-in-ftplugin-td1184917.html
.........................
✶ that  and other weird characters - it's the BOM made visible:
- Can't see it in the file, but it shows up in the html or something.
- It "is a magical character, invisible to the human eye,
but readable by a computer.
It is the byte order mark (or BOM) and it’s telling the computer
that the characters that follow are encoded in Unicode."
-- https://www.roelpeters.be/removing-i-umlaut-two-dots-data-frame-column-read-csv/
"If a string is encoded and then reencoded with a different encoding,
the BOM can appear as a different character, like ÿ"
-- https://www.qvera.com/kb/index.php/565/why-is-%C3%AF-at-the-start-of-my-file-and-how-do-i-remove-them
- How to remove it from displaying:
Many ways found in search.
What works for me is to check the fileencoding, make sure it is utf-8,
and for me, go ahead and :set bomb, because i use asian scripts.
.........................
✶ Show fileencoding and bomb in the status line:
Kinda complicated; haven't tried it cause i don't really need it.
But here it is:
* https://vim.fandom.com/wiki/Show_fileencoding_and_bomb_in_the_status_line
.......................................................
➽ links and resources:
* All about the Byte Order Mark (BOM):
- https://en.wikipedia.org/wiki/Byte_order_mark
- https://simple.wikipedia.org/wiki/Byte_order_mark
- http://www.unicode.org/faq/utf_bom.html
* Removing the Byte Order Mark (BOM):
- http://vim.1045645.n5.nabble.com/How-to-display-and-remove-BOM-in-utf-8-encoded-file-td4681708.html
- https://www.roelpeters.be/removing-i-umlaut-two-dots-data-frame-column-read-csv/
- https://www.qvera.com/kb/index.php/565/why-is-%C3%AF-at-the-start-of-my-file-and-how-do-i-remove-them
* Lots of good links:
- https://www.google.com/search?q=vim+show+file+encoding
* Working with Unicode
- https://vim.fandom.com/wiki/Working_with_Unicode
_______________________________________________________
begin 23 oct 2022
-- 0 --