PowerShell 5.1含西里尔字母‘т’的哈希/列表字面量执行失败
PowerShell 5.1 处理西里尔字母‘т’时解析错误问题
在PowerShell 5.1中,执行包含西里尔字母‘т’的哈希表或数组字面量脚本时,会出现解析错误。
示例UTF-8编码脚本:
$dict = @{'т' = '123'} # 或者 $list = 'z', 'т' echo 'Hello world'
执行上述脚本后,会产生以下错误:
At C:\xxx\test.ps1:1 char:19
- $dict = @{'С‚' = '123'}
~Missing '=' operator after key in hash literal.
At C:\xxx\test.ps1:2 char:18
- echo 'Hello world'
~The string is missing the terminator: '.
At C:\xxx\test.ps1:1 char:19
- $dict = @{'С‚' = '123'}
~The hash literal was incomplete.
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : MissingEqualsInHashLiteral
使用的PowerShell版本信息:
Name Value ---- ----- PSVersion 5.1.17763.6640 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.17763.6640 CLRVersion 4.0.30319.42000
内容的提问来源于stack exchange,提问作者syozh
相关产品推荐
相关产品推荐

