3 ms·
PowerShell defaults to UTF-16 encoding, indeed. It's a design choice on a system that uses UTF-16LE as its character encoding and one from the early 2000s. UTF-
by ygra 10y ago
PowerShell defaults to UTF-16 encoding, indeed. It's a design choice on a system that uses UTF-16LE as its character encoding and one from the early 2000s. UTF-8 wasn't nearly as prevalent back then. However, the text in both files is still the same.
Get-Content -Tail some1gbfile.txt
works quite well, by the way.
- elchief 10y agowell, enjoy typing Get-Content -Encoding utf8 .\utf8.txt | Out-File -Encoding utf8 out.txt and manually removing the BOM, for the rest of your life
- ygra 10y agoIt's still the same text. Not all of us have to deal with tools that can't handle Unicode or require exact byte-for-byte round trips. Yes, it bugs me too, from time to time, although less so than the extra line break at the end. In that case I have to go through [IO.File]::ReadAllText and ::WriteAllText and thus deal with full paths again. There are a few gotchas. However, by now we can actually fix that issue. The encoding parameter that the file system provider adds to a bunch of cndlets is an enum and we can add a new value there.