-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Wrong encode in Invoke-RestMethod -Body (problem with cyrilic symbols) #7618
Copy link
Copy link
Closed
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module
Description
Steps to reproduce
Invoke-RestMethod -Uri $URI -Method Put -ContentType 'application/json' -Body '{"jsonrpc":"2.0","method":"get.object","params":{"latname":"testing","cyrname":"проверка"}}'
Expected behavior
http request json
{"jsonrpc":"2.0","method":"get.object","params":{"latname":"testing","cyrname":"проверка"}}
Actual behavior
http request json
{"jsonrpc":"2.0","method":"get.object","params":{"latname":"testing","cyrname":"????????"}}
Environment data
Name Value
PSVersion 6.1.0-rc.1
PSEdition Core
GitCommitId 6.1.0-rc.1
OS Microsoft Windows 10.0.17134
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Description
It works good if -InFile Parameter is used
Invoke-RestMethod -Uri $URI -Method Put -ContentType 'application/json' -InFile $FilePath File must be encoded in UTF-8 with no BOM
I think cmdlet encodes body to ASCII
In PS 5.1, 6.0 the same bug is.
Thanks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module