我想在PowerShell中使用xmlstarlet,在C#应用程序中启动Process。 我的主要问题是,当我使用此代码:Xmlstarlet编码和PowerShell里面的进程C#
./xml.exe ed -N ns=http://www.w3.org/2006/04/ttaf1 -d '//ns:div[not(contains(@xml:lang,''Italian''))]' "C:\Users\1H144708H\Downloads\a.mul.ttml" > "C:\Users\1H144708H\Downloads\a.mul.ttml.conv"
在PowerShell中,我得到了错误的编码(我需要UTF-8)的文件。
巴蜀我以前只是
export LANG=it_IT.UTF-8 &&
xmlstarlet之前,但在PowerShell中我真的不知道该怎么做。 也许有另一种方法,我看到xmlstarlet能够使用sel --encoding utf-8,但我不知道如何在ed模式下使用它(我尝试在ed之后的xml.exe之后使用它。但它总是失败)。
什么是导出LANG = it_IT.UTF-8或如何使用 - 编码UTF-8的替代方案?
PS。我试过很多,很多事情,如:
$MyFile = Get-Content "C:\Users\1H144708H\Downloads\a.mul.ttml"; $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False; [System.IO.File]::WriteAllLines("C:\Users\1H144708H\Downloads\a.mul.ttml.conv", $MyFile, $Utf8NoBomEncoding)
和:
./xml.exe ed -N ns=http://www.w3.org/2006/04/ttaf1 -d '//ns:div[not(contains(@xml:lang,''Italian''))]' "C:\Users\1H144708H\Downloads\a.mul.ttml" | Out-File "C:\Users\1H144708H\Downloads\a.mul.ttml.conv" -Encoding utf8
但类似E I U字仍然是错误的。如果我在转换之前尝试使用记事本保存原始文件(仅当我不使用xmlstarlet时)...但我需要在PowerShell中执行同样的操作,但我不知道如何执行。
编辑。 我能打印在PowerShell中我UTF8:
Get-Content -Path "C:\Users\1H144708H\Downloads\a.mul.ttml" -Encoding UTF8
但我还是没能做到同样的事情xmlstarlet。