Encoding issue on Shinyapps.io deployment

Hello, I have a Shinyapp working well in locale, but when deployed on Shinyapps.io an enconding problem (I think) comes up. In particular, the app asks for a csv as input containing also character strings that must be manipulated with functions like gsub.
From the LOGS I can see that the problem is on make.names: multibyte string 12 not valid:

2018-09-12T09:31:54.091730+00:00 shinyapps[436201]: File Orders.csv was uploaded
2018-09-12T09:31:54.256057+00:00 shinyapps[436201]: Stack trace (innermost first):
2018-09-12T09:31:54.256068+00:00 shinyapps[436201]:     104: <reactive:mydf> [/srv/connect/apps/vpkas/app.R#107]
2018-09-12T09:31:54.091733+00:00 shinyapps[436201]: Standardizing Enduser Names... 
2018-09-12T09:31:54.256060+00:00 shinyapps[436201]:     119: make.names
2018-09-12T09:31:54.256062+00:00 shinyapps[436201]:     118: read.table
2018-09-12T09:31:54.256069+00:00 shinyapps[436201]:      93: mydf
2018-09-12T09:31:54.251433+00:00 shinyapps[436201]: **Warning: Error in make.names: stringa mulibyte 12 non valida**
2018-09-12T09:31:54.256077+00:00 shinyapps[436201]:      11: doTryCatch
2018-09-12T09:31:54.256063+00:00 shinyapps[436201]:     117: read.csv
2018-09-12T09:31:54.256065+00:00 shinyapps[436201]:     116: <reactive:dataframe> [/srv/connect/apps/vpkas/app.R#28]
2018-09-12T09:31:54.256070+00:00 shinyapps[436201]:      92: renderDataTable [/srv/connect/apps/vpkas/app.R#167]
2018-09-12T09:31:54.256073+00:00 shinyapps[436201]:      89: output$customers
2018-09-12T09:31:54.256075+00:00 shinyapps[436201]:      13: runApp
2018-09-12T09:31:54.256071+00:00 shinyapps[436201]:      91: func
2018-09-12T09:31:54.256103+00:00 shinyapps[436201]:       6: eval
2018-09-12T09:31:54.256076+00:00 shinyapps[436201]:      12: fn
2018-09-12T09:31:54.256099+00:00 shinyapps[436201]:       9: tryCatchList
2018-09-12T09:31:54.256109+00:00 shinyapps[436201]:       2: eval.parent
2018-09-12T09:31:54.256066+00:00 shinyapps[436201]:     105: df
2018-09-12T09:31:54.256078+00:00 shinyapps[436201]:      10: tryCatchOne
2018-09-12T09:31:54.256107+00:00 shinyapps[436201]:       4: eval
2018-09-12T09:31:54.256112+00:00 shinyapps[436201]:       1: local
2018-09-12T09:31:54.256072+00:00 shinyapps[436201]:      90: origRenderFunc
2018-09-12T09:31:54.256101+00:00 shinyapps[436201]:       8: tryCatch
2018-09-12T09:31:54.256105+00:00 shinyapps[436201]:       5: eval
2018-09-12T09:31:54.256102+00:00 shinyapps[436201]:       7: connect$retry
2018-09-12T09:31:54.256108+00:00 shinyapps[436201]:       3: eval

Reading discussions I saw that the problem is related to Windows native encoding. I tried to use enc2native on character columns but I feel like I was not using it properly.
Any suggestion on how to solve it?

I solved the problem.
The shinyapps.io service runs on a Linux platform. So a file with a native Windows encoding cannot be loaded correctly in A linux enviroinment giving the error multibyte string 12 not valid.
The solution was to use the function read_delim specifying the input file encoding in the argument locale.

1 Like