build.ps1: Moved repeated "add utf-8 BOM" code to its own function.