Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Powershell将替换特殊字符_Html_Powershell_Batch File_Cmd_Scripting - Fatal编程技术网

Html Powershell将替换特殊字符

Html Powershell将替换特殊字符,html,powershell,batch-file,cmd,scripting,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: " powershel

我有一个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
替换“u quot.ps1”文件

(Get-Content Name_of_File.html) -replace '"', '"' | set-content 
Name_of_File.html
但正如我所说,如果我插入æø或å,它不会立即插入它们

链接到我的第一篇文章,以防您需要更多上下文:

我希望我解释得足够好,如果你有什么不明白的地方,就写下来,然后我会尽力澄清

字符集是UTF-8

HTML文件的作用是什么,因为这决定了HTML文件中的文本数据使用哪种格式?如果你对字符编码一无所知,特别是在HTML文件中,请阅读UltraEdit用户对用户论坛。我相信这就是你要找的那句话:所以我的假设是正确的。您已将HTML文件声明为已编码,但插入了已编码的文本。您可以将
字符集
声明更改为
,当然,还可以确保HTML文件的其余部分是真正的Windows-1252编码的,这很可能只包含ASCII字符。那么脚本上就没有什么可更改的了。否则,在将文本插入HTML文件之前,必须将文本从Windows-1252转换为UTF-8。有关第二种解决方案,请参阅使用搜索词的堆栈溢出搜索找到的示例。
Set Content
cmdlet具有
-Encoding
选项<代码>帮助设置内容-完整