Fix parsing file failure encoded "utf-8 with bom"

[closes #1154]

Also 2 test cases added for "utf8 with bom" and "utf8 without bom"