我有一个 html 文件测试.html用atom创建,其中包含:
Testé 编码 utf-8
当我使用 Powershell 控制台阅读它时(我使用的是法语 Windows)
Get-Content -Raw test.html
我得到这个:
Testé encoding utf-8
为什么重音字符打印不正确?
所以,为了Get-Content
认识一个BOM-lessUTF-8 文件正确地在 Windows PowerShell 中,您必须use -Encoding utf8
.
[1] By contrast, the cross-platform PowerShell Core https://github.com/PowerShell/PowerShell edition commendably defaults to UTF-8, consistently across cmdlets, both on reading and writing, so it does interpret UTF-8-encoded files correctly even without a BOM and by default also creates files without a BOM.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)