Character Encoding in Content Files

I noticed I have some md files with incorrect character encodings, so changed them to UTF-8 and hugo didn’t like it. Just to double check I changed the encoding of config.toml to UTF-8 and hugo couldn’t parse it.

I am running on windows and when I create a new site (hugo.exe new site mysite) everything defaults to ANSI. Am I missing something?


I’m on mac, and have all files in utf-8 and unix line endings, with no problems from Hugo.

Does your hugo server command give an error in the console and if so, what is it?

Could it be some odd issue with your editor?

Thanks Rick,

That got me going. I set up the project on a network share which could be accessed from my windows machine and a mac. Then I used a different editor (Sublime), as opposed to Visual Studio and notepad. The UTF-8 files created by Hugo worked fine in both environments. The issue was the UTF-8 encoding used by notepad and Visual Studio was UTF-8 with BOM, and that is what was causing the error:

ERROR: 2015/06/15 Error parsing config: Near line 0 (last key parsed ‘’): Bare keys cannot contain ‘\ufeff’.

The encoding I needed in Visual Studio was Unicode (UTF-8 without signature) - Codepage 65001

Thanks again

1 Like

sure thing. Glad it’s fixed.