Using PowerShell to write a file in UTF-8 without the BOM

Note: This answer applies to Windows PowerShell (the legacy, ships-with-Windows, Windows-only edition of PowerShell whose latest and last version is 5.1); by contrast, in the cross-platform PowerShell (Core) 7 edition, UTF-8 without BOM is the default encoding, across all cmdlets. In other words: If you’re using PowerShell (Core) 7, i.e. version v7.x, you get BOM-less UTF-8 files by default …

Read More