Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for unicode chars in PowerShell output #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Support for unicode chars in PowerShell output
Please see the support case "[Harvest Support] "Support for unicode chars in the API?"". The output does not support special chars when using Invoke-WebRequest. For some reason it uses the wrong encoding.

https://social.technet.microsoft.com/Forums/Lync/en-US/d795e7d2-dcf1-4323-8e06-8f06ce31a897/bug-invokerestmethod-and-utf8-data?forum=winserverpowershell

/Peter Selch Dahl
PeterSelchDahl authored Apr 18, 2019
commit 5d098fb0cddd289a9c6329f3b59708761778eecb
3 changes: 2 additions & 1 deletion v2/harvest_api_sample.ps1
Original file line number Diff line number Diff line change
@@ -3,4 +3,5 @@ $Headers = @{}
$Headers.Add("Authorization", "Bearer " + $Env:HARVEST_ACCESS_TOKEN)
$Headers.Add("Harvest-Account-ID", $Env:HARVEST_ACCOUNT_ID)

Invoke-WebRequest -Uri $Url -Headers $Headers | ConvertFrom-Json
$content = [system.Text.Encoding]::UTF8.GetString((Invoke-WebRequest -Uri $Url -Headers $Headers).RawContentStream.ToArray())
$content | ConvertFrom-Json