PowerShell and SharePoint REST – Unable to translate bytes from specified code page to Unicode


I recently had to transfer a large amount of CSV lines to a SharePoint list and decided that the PowerShell command Invoke-WebRequest and the SharePoint REST API would be a good match to get this done.

I build a PSObject for each CSV line as in

And then convert that to JSON when posting as in


Everything was going great until I hit some values containing the Danish characters æ,ø, and å. SharePoint threw a fit and returned the error


Use [System.Text.UTF8Encoding]  to get the bytes in UTF-8 encoding and post that

Hope this helps someone 🙂


You may also like...

1 Response

  1. Reinout says:

    It does! Thnx!

Leave a Reply

Your email address will not be published. Required fields are marked *