You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 10:13:17