Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello everyone
I am making a solution for a customer that grabs some data from a couple of REST web services using PowerShell.
then it injects to PowerBI using the PowerBI REST API.
To do this I am using this powershell wrapper/module:
https://github.com/DevScope/powerbi-powershell-modules
It works great! Except that the danish letters æ,ø,å does not show correctly.
1. I can see that my source data is correct, outputted in powerShell shows æ,ø,å correctly.
2. Module uses Invoke-RestMethod to send the data.
3. I have tried to set "charset"= "utf-8" in the headers for the sending of the data.
4. Data seems to show OK if I try to get something direct from a REST web service that also has æ,ø,å. (But I cannot use this method as the datasources does not support my other rest webservice.
but you see, they show like this:
I can confirn that it is not only the visual that does not show it, as I cannot make filters on data using any of the letters.
Does anyone know where this fails? and how to fix it?
Solved! Go to Solution.
seems to be a powerShell issue for invoke-restmehtod and invote-websrequest as they cannot send as UTF8.
I have rewritten my powershell to make a call.
https://docs.microsoft.com/en-us/power-bi/developer/walkthrough-push-data-add-rows
Will send pull request to update the moduel asap, and then i hope he accepts 🙂
Prototype code (not pretty but works :)):
Function Invoke-PBIWebRequestPost { param($Uri, $Headers,$Body) # Remove NewLine from json $Body = $Body -replace "$([Environment]::NewLine) *","" write-verbose "Posting data to URL: $Uri" $request = [System.Net.WebRequest]::Create($uri) -as [System.Net.HttpWebRequest]; $request.KeepAlive = $false; $request.Method = "POST"; $request.ContentLength = 0; $request.TimeOut = 100000; #5 minute timout #Add token to the request header foreach($key in $headers.Keys) { switch($key){ "Content-Type"{ $request.ContentType = $headers[$key]; } default { $request.Headers.Add($key, $headers[$key]); } } } $rowsJson = $Body $utf8Bytes = [System.Text.Encoding]::UTF8.GetBytes($Body) $request.ContentLength = $utf8Bytes.Length $postStream = $request.GetRequestStream() $postStream.Write($utf8Bytes, 0, $utf8Bytes.Length) #Write-String -stream $postStream -string $JSON $postStream.Dispose() try { #[System.Net.HttpWebResponse] $response = [System.Net.HttpWebResponse] $request.GetResponse() $response = $request.GetResponse() } catch { $response = $Error[0].Exception.InnerException.Response; Throw "Exception occurred in $($MyInvocation.MyCommand): `n$($_.Exception.Message)" } $reader = [IO.StreamReader] $response.GetResponseStream() $output = $reader.ReadToEnd() $reader.Close() $response.Close() return $output }
seems to be a powerShell issue for invoke-restmehtod and invote-websrequest as they cannot send as UTF8.
I have rewritten my powershell to make a call.
https://docs.microsoft.com/en-us/power-bi/developer/walkthrough-push-data-add-rows
Will send pull request to update the moduel asap, and then i hope he accepts 🙂
Prototype code (not pretty but works :)):
Function Invoke-PBIWebRequestPost { param($Uri, $Headers,$Body) # Remove NewLine from json $Body = $Body -replace "$([Environment]::NewLine) *","" write-verbose "Posting data to URL: $Uri" $request = [System.Net.WebRequest]::Create($uri) -as [System.Net.HttpWebRequest]; $request.KeepAlive = $false; $request.Method = "POST"; $request.ContentLength = 0; $request.TimeOut = 100000; #5 minute timout #Add token to the request header foreach($key in $headers.Keys) { switch($key){ "Content-Type"{ $request.ContentType = $headers[$key]; } default { $request.Headers.Add($key, $headers[$key]); } } } $rowsJson = $Body $utf8Bytes = [System.Text.Encoding]::UTF8.GetBytes($Body) $request.ContentLength = $utf8Bytes.Length $postStream = $request.GetRequestStream() $postStream.Write($utf8Bytes, 0, $utf8Bytes.Length) #Write-String -stream $postStream -string $JSON $postStream.Dispose() try { #[System.Net.HttpWebResponse] $response = [System.Net.HttpWebResponse] $request.GetResponse() $response = $request.GetResponse() } catch { $response = $Error[0].Exception.InnerException.Response; Throw "Exception occurred in $($MyInvocation.MyCommand): `n$($_.Exception.Message)" } $reader = [IO.StreamReader] $response.GetResponseStream() $output = $reader.ReadToEnd() $reader.Close() $response.Close() return $output }
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
12 | |
2 | |
1 | |
1 | |
1 |
User | Count |
---|---|
20 | |
3 | |
2 | |
2 | |
2 |