Powershell替换特殊字符

时间:2018-09-08 09:00:52

标签: html powershell batch-file cmd scripting

我有一个Powershell脚本,可将Som文本插入.html文档中。但是,当我住在丹麦时,我遇到了一个大问题。我要在没有大写字母的情况下插入“攓ø”“å”。 Powershell将这些字母替换为“ xE6”,“ xF8”,“ xE5”。 HTML使它看起来像这样:

有人知道如何解决此问题吗?

当前脚本:

第一个.bat文件

echo off
set /p Date="Date: "
set /p Location="Location: "
set /p Amount="Amount: "

powershell -command "(Get-Content Name_of_file.html) -replace 
'Text that gets replaced, using the variables up top' | Set-Content 
Name_Of_File.html"
Powershell.exe -executionpolicy remotesigned -File replace_quot.ps1
exit

replace_quot.ps1文件

(Get-Content Name_of_File.html) -replace '"', '"' | set-content 
Name_of_File.html

但是正如我所说,如果我插入æø或å不会正确插入它们。

如果需要更多上下文,请链接到我的第一篇文章:Add a string of text into a html document using cmd/batch file

我希望我已经对此进行了充分的解释,如果您不了解某些内容,然后再写,那么我会尽力澄清。

字符集为UTF-8     

0 个答案:

没有答案
相关问题