Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Lots of explanations, but why can't you globally configure reading with no BOM if writing with no BOM is now the default?

It doesn't seem like it could be for backwards compatibility, as now an old script that writes a file with defaults can't later read it with defaults?



I work regularly in PowerShell and this bugged tf out of me. The result of my digging was: .NET libraries emit textual output in <whatever the offending encoding was, UTF-16 LE or something> -- and since PowerShell is implemented in .NET, it necessarily inherited that default.

Things have improved since then now that everything is implemented in .NET (Core), so if you're working with PoSH 7.x, this is no longer a headache. (I just tested in 5.1, and it seems fixed now, as well.)

Of course, by now, I've just developed muscle memory to add '-enc UTF8' to the end of everything that writes text to disk.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: