Forum Discussion
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
- lbendlinSuper User
That sounds like you use 1252 (Western) character set when you should be using 65001 (UTF-8)
- AnonymousNot 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
- lbendlinSuper User
I think you want to look at your source data. The encoding may already be broken at the source.
- AnonymousNot applicable
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 luckcolumnNames[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