Solve

While reading config files with utf-8 BOM header, configphaser throws this confusing exception.

While most of the online solutions suggests manually change the encoding of the file to ANSCII, or read the file and save it again in another format. The former drops support to special characters and the latter is just not easy enough.

I found that the default ConfigPhaser uses non-encoded format. In order to make sure it reads the file in the correct format:
configphaser.ConfigPhaser().read(config_file, encoding="utf-8-sig")

This should tell the phaser to use the utf-8 encoding with bom.

2017/9/5