包含批处理中的变音符号的打开URL [英] Open URL that contains umlaut with batch
问题描述
我想用批处理文件打开Chrome中的URL.这适用于普通网址,但不适用于带有变音符号的网址.
I want to open an URL in chrome with a batch file. This works for normal URLs, but it doesn't for URLs with umlauts.
start chrome.exe https://trends.google.de/trends/explore?q=mähroboter
我不能用"ae"代替ä",因为它会在Google趋势中给我带来不同的结果.
I cannot use "ae" as a replacement for "ä", as it will give me different results on Google Trends.
当我这样保存时,浏览器中的URL更改为
When I keep it like this, the URL in my browser changes to
https://trends.google.de/trends/explore?q=mA4hroboter
这又给了我错误的结果.它必须是ä".
which again gives me the wrong results. It needs to be "ä".
我尝试使用文件编码.目前没有BOM的UTF8.我尝试将UTF8与BOM,ANSI进行往返转换.似乎没有任何作用.我该怎么做才能使其正常工作?
I tried playing around with the file encoding. Currently UTF8 without BOM. I tried UTF8 with BOM, ANSI, converting to and fro. Nothing seemed to work. What can I do to make it work?
推荐答案
这意味着 URL 中的德语变音符号ä
首先被 UTF-8 编码为带有十六进制值 C3的两个字节A4
和下一个百分比编码,从而在URL字符串中生成%C3%A4
:
That means the German umlaut ä
in a URL must be first UTF-8 encoded with the two bytes with the hexadecimal values C3 A4
and next percent-encoded resulting in %C3%A4
in the URL string:
https://trends.google.de/trends/explore?q=m%C3%A4hroboter
在批处理文件中,必须转义百分号和其他百分号,以使Windows命令处理器将其解释为文字字符而不是
In a batch file a percent sign must be escaped with an additional percent sign to get it interpreted by Windows command processor as literal character and not
- 作为批处理文件参数引用的开头,如在命令提示符窗口中运行
call/?
时在命令 CALL 的帮助下解释的那样,或 - 开始循环变量引用,如在命令提示符窗口中运行
for/?
时通过命令 FOR 输出的帮助所述,或 - 环境变量引用的开头/结尾,如在命令提示符窗口中运行
set/?
时通过命令 SET 输出所解释的那样.
- as beginning of a batch file argument reference as explained by help of command CALL output on running
call /?
in a command prompt window, or - beginning of a loop variable reference as explained by help of command FOR output on running
for /?
in a command prompt window, or - beginning / end of an environment variable reference as explained by help of command SET output on running
set /?
in a command prompt window.
因此必须使用批处理文件:
So in the batch file must be used:
start chrome.exe https://trends.google.de/trends/explore?q=m%%C3%%A4hroboter
这篇关于包含批处理中的变音符号的打开URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!