Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

TIL April 28

TIL #Python #BOM #Encoding #UTF-8 #bvi #Hex-editor

In yesterday’s post, I presented a Python script to convert Pelican preamble files to YAML for Hugo.

For some UTF-8 files, there is a BOM marker at the beginning of the file. The script (as a true quick and dirty solution) doesn’t check for the presence of such a marker and cannot detect the Title element if it exists.

I added an fm = fm.strip('\ufeff') line to clear the BOM marker from a line if it exists.


There is an editor called bvi to edit binary files in Hex format, similar to the vi editor.