【问题标题】:How to pass non-english chars in an api post command如何在 api post 命令中传递非英语字符
【发布时间】:2021-11-27 21:01:49
【问题描述】:

我正在编写一个 powershell 脚本并尝试使用 Azure DevOps api 运行一个 post 命令,但是我的一个值包含非英语字符,并且 Invoke-RestMethod 总是失败并显示: {"$id":"1","innerException":null,"message":"您必须在请求正文中传递有效的补丁文档。","typeName":"Microsoft.VisualStudio.Services.Common. VssPropertyValidationException, Microsoft.VisualStudio.Services.Common","typeKey":"VssPropertyValidationException","errorCode":0,"eventId":3000} 如果我删除非英语字符,它会按预期工作。

我需要做什么,才能让非英语字符在 json 正文中被接受。

【问题讨论】:

    标签: powershell azure-devops-rest-api


    【解决方案1】:

    想通了。只需将“;charset=UTF-8”添加到我的内容类型。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-30
      • 2016-10-28
      • 1970-01-01
      • 2012-01-02
      • 2015-02-08
      • 2017-07-26
      相关资源
      最近更新 更多