powershell - 如何在 api post 命令中传递非英语字符
问题描述
我正在编写一个 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 正文中被接受。
解决方案
弄清楚了。只需将“;charset=UTF-8”添加到我的内容类型。
推荐阅读
- vuex - 带有 vuex-persist 的 Nuxt.js - 页面刷新时在 asyncData 中不可用的持久状态
- c++ - 为什么这只是一个角落案例失败?问题链接-https://www.hackerearth.com/problem/algorithm/chandu-and-his-interns/description/#c190148
- events - Google Analytics 事件跟踪代码不起作用
- python - 如果列表中只有一个元素,则列表切片语法python
- phonegap-build - 如何为使用 PhoneGap Build 构建的 PhoneGap 项目请求权限?
- c++ - Openssl:PEM_read 中的段错误
- php - 如何在 Laravel 中跟踪通知?
- css - 对 svg 文本元素进行变换不会移动元素
- etl - Informatica Cloud 中的目标加载计划,一个映射中的多个(两个)管道
- django - UnboundLocalError:分配前引用的局部变量“team_members”