0

When in the Powershell terminal in VS Code, I used echo $null >> day10.rs to make a new rust file. I realized that this was causing problems because rust only uses UTF-8 encoded files and the default action for this command was encoding the new file as UTF-16 LE.

Is there a way to change the default to UTF-8?

Lacrosse343
  • 274
  • 1
  • 9
  • In short: In _Windows PowerShell_, in v5.1 only (the latest and last version), you can make `>` and `>>` produce UTF-8 files with `$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'`, but note that the files will invariably have a _BOM_. In _PowerShell (Core) v6+_, BOM-less UTF-8 is the default character encoding anyway. See the [accepted answer](https://stackoverflow.com/a/51847431/45375) to the linked duplicate. – mklement0 Dec 11 '21 at 19:18

0 Answers0