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

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.

Reply
Anonymous
Not applicable

Power BI Custom Visual in R problem with international characters

Hi

 

I am developing a Power BI Custom Visual R html. Everything works fine except when writing international characters like the norwegian letters æ ø å it looks terrible. It actually comes out in power bi desktop as Ã, in stead of ø and Ã| in stead of æ and so on. I have tried to search the community, but I haven't found any solution on this. It works nicely in RStudio, but when I run this code in visual code and create a pbiviz package command and then update the component in Power BI desktop the characters turn up as non character. The customers react badly on this and I hope somebody has a solution on this.

 

thanks and regards Geir

6 REPLIES 6
Anonymous
Not applicable

dump report.png

Here you can see my Power BI Custom Visual in R (plotly and ggplot2). The text you see under Values on the right should be seen in the legends part of the R html visual. It is ok in RStudio but when it is shown in Power BI Desktop, it has some terrible characters for the Norwegian special characters Ø Æ Å.

 

I have tried to search the net for solutions. I have tried to put the character as unicode like \u00D8, but with no luck. I have tried put these lines in my code 

##########################

libraryRequireInstall("ggplot2")
libraryRequireInstall("plotly")
libraryRequireInstall("readr")
libraryRequireInstall("dplyr")
libraryRequireInstall("scales")
libraryRequireInstall("stringi")
libraryRequireInstall("showtext")

showtext.auto(enable = TRUE)
Sys.setlocale("LC_ALL","Norwegian"# Internationalization 
#options(encoding = "UTF-8")   # <- This one makes it even worse
##########################
 
I have also tried to the my variable as this:, but no luck
 columnNames[3] <- stri_encode(columnNames[3], "", "UTF-8")

 

One thing I have discovered is that I ran into the same problem with other Custom R Visuals from Microsoft App Source. There must be something wrong in Power BI Desktop that corrupts these characters. I can't use Power Query since all come from the component. The customer is complaining of course 😞

 

Is there any one out there that can explain to me what is wrong here

 

regards Geir

 

lbendlin
Super User
Super User

That sounds like you use 1252 (Western) character set when you should be using 65001 (UTF-8)

Anonymous
Not applicable

hi again I have added some more details about my case you responded. I can perhaps look at the new added information to see if there are anything you can look at.

 

regards geir

I think you want to look at your source data. The encoding may already be broken at the source.

Anonymous
Not applicable

  • Hi again 
  •  
  • it is strange. On the title line on the x axis the is the text hard coded. So it can't be that the source measure text is the reason for this. It must be something in the encoding an translation back to Power bi. And this also happens with other R visual components on Microsoft visual store
Anonymous
Not applicable

dump report2.png

 

Here you can see my code run in RStudio. The data is dumped from the Power BI desktop. Here you can see the legends and the x axis title are showing the characters correctly. It can be that when the custom component run the code and receiving the data. It can be different. But I don't know if it is possible to debug the R code in Visual Code when hitting the refresh button in my power bi report. I don't know how to discover this except make my code write to a file

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors