Search code examples
rshinyencode

Struggling with character encoding with ShinyApp


I'm struggling with character encoding with my ShinyApp. I'm using ShinyProxy for deploying the apps.

I read my data as JSON encoded in UTF-8 with:

 json_file = fromJSON(d, encoding = "UTF-8") 

Then my code analyse the JSON and create a DataFrame.

Now i convert everything in UTF-8 with:

for (col in colnames(df)){
            Encoding(df[[col]]) <- "UTF-8"}

Now from RStudio I read "Belgi<eb>" but in my datatable on shinyproxy is rendered as "Belgi�" (it's should be België).

Thanks for any help.


Solution

  • I solved it. Turns out that België in not "UTF-8" but it's "latin1". So it is sufficient to encode it as "latin1".