Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
JakobGsvendsen
Frequent Visitor

REST API Injected data - special local letter do not show correctly.

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.

   'Content-Type' = 'application/json; charset=utf-8'

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:

https://user-images.githubusercontent.com/3460807/32954956-dcfdb1e6-cbb4-11e7-8441-a394eadd4170.png

 

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?

 

 

1 ACCEPTED SOLUTION
JakobGsvendsen
Frequent Visitor

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  
			
			

}

 

 

View solution in original post

1 REPLY 1
JakobGsvendsen
Frequent Visitor

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  
			
			

}

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.