diff --git a/ebv_metadata_app.R b/ebv_metadata_app.R
index 313876f30fa88da8e773fa5cfaf1553efec5f1d5..8ea3e402e366ae8f91b7202d5f17da8558793f92 100644
--- a/ebv_metadata_app.R
+++ b/ebv_metadata_app.R
@@ -17,11 +17,19 @@ t <- tryCatch(
     install.packages('checkmate')
   }
 )
+t <- tryCatch(
+  {find.package("withr")},
+  error = function(e){
+    install.packages('withr')
+  }
+)
 
 #load libraries
 library(shiny)
 library(stringr)
 library(checkmate)
+library(withr)
+
 
 ui <- fluidPage(
   #set style
@@ -1026,8 +1034,9 @@ server <- function(input, output) {
     ]
 }')
 
-            #write to file
-            write(json, input$outputpath)
+
+            #write to file and set encoding
+            withr::with_options(list(encoding = "UTF-8"), write(json, input$outputpath))
           }