Wrong encoding on PowerShell Invoke-WebRequest POST

This worked for me:

$postData = "žluťoučký kůň úpěl ďábelské ódy"
Invoke-WebRequest -Uri 'http://www.example.com/' -Method Post -Body $postData 
 -ContentType "text/plain; charset=utf-8"

Adding the charset=utf-8 fixed my issue where the acute accent characters were getting converted to special symbols.

Leave a Comment