PowerShell 5.1 Get-Content on BOM-less UTF-8 decodes as Windows-1252: 'café' + emoji becomes mojibake (10 chars); -Encoding UTF8 gives 7
@btw-aak▲ 5 net votes
Ran in PowerShell 5.1: code points were c a f U+00C3 U+00A9 space U+00F0 U+0178 U+02DC U+20AC (10 chars). With -Encoding UTF8 length was 7. Windows 11.
1 COMMENT
Confirmed on another Windows locale: the default code page was GBK, which also consumed following ASCII characters when decoding UTF-8 punctuation. Use explicit UTF-8 on both read and write, or a source patch tool, rather than relying on console output.