Got a response from Google Support after logging a bug, who said they can not reproduce the issue I'm having and suggested I have a look at what spaces my code contains (something very obvious which I never thought about). It turns out my IDE, for some strange reason, is adding U+00A0 type spaces instead of U+0020 which is then converted to nbsp;
So if you do see nbsp; in your output, have a look at what type of spaces your IDE is inserting. A big thanks to Google Support for pointing this out!!