Forum Discussion
Different encoding in Power BI Desktop and Power BI Services (R script visual)
Hi,
I use R script visual in Power BI desktop. I make a plot with ggplot library and I use encoding UTF-8 (which I use in R in my computer). I used for change script button "Edit script in external R IDE", where the data is loaded specialy with UTF-8 encoding.
# Input load. Please do not change #
`dataset` = read.csv('C:/Users/mlasakova/REditorWrapper_331965a2-f26e-41b1-a11e-19984fe5008c/input_df_db204648-f8f7-4ce8-bc69-9a0df5fef2f6.csv', check.names = FALSE, encoding = "UTF-8", blank.lines.skip = FALSE);
# Original Script. Please update your script content here and once completed copy below section back to the original editing window #The final plot in Power BI Desktop looks like this:
But when I publish this script on Power BI services, then the encoding of special characters is wrog (specifically in axis labels) and it looks like this:
Can I change somehow this encoding?
9 Replies
- AnonymousNot applicable
I'm having the same issue.
Have you found any solutions or workarounds?
- v-chuncz-msftCommunity Support
This seems to be an issue of language. You may check Languages for the Power BI service.
- mischelin11Advocate I
Hi v-chuncz-msft,
Thank you for your answer, but changing language doesn't solve this problem. The encoding in build-in object, for example text boxes or titles of visuals work good without problem. But the R script visual still doesn't work.
- santiagomoncadaFrequent Visitor
Hi mischelin11
did you solve your problem?
I have the same problem with special characters. When I make a r custom visual, The custom Visual works in Power Bi Desktop however when I publish it in Power Bi Service the special characters doesn't work well.If you resolved your problem, can you help me with this ?
- AnonymousNot applicable
Same problem here.
Maybe with the R Version running on powerBi Server, which is too old (3.4.4).
Is there any plants to update it?
- AnonymousNot applicable
I have found a possible workaround for this issue. Although it is far from optimal.
You can avoid explicitly stating the values of the x-axis and the y-axis by dynamically referencing items in your dataset. That way the encoding is parsed on Power BI level or the browser level, and not the server side R engine level.
For example, change the parameter from this
gg + x_lab("Mesice (format rokmesic)") # you would include your special characters in this (I am using Lithuanian specific characters ą, č, ę, ė and so on..)
to this
col_number <- 1 # the position of the column of interest. It can be 1, 2 or any other, depending on the number of columns in your selected dataset
gg + x_lab(colnames(dataset[col_number]))
If the column name of the first item in your dataset is correct, you should get axes' names that are displayed correctly (incl. the special characters).
Now, this does add a few caveats and complicates the workflow in the script. And in some cases you will need to add additional columns to your dataset just for the naming. But it does solve the utf-8 symbol problem. Be it in a very roundabout way.
- FipaFANFrequent Visitor
Since 2018 and no solution to this?!