From 2a92a96aac277b1da14b54a3cf47daf4ce2f71d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luise=20Quo=C3=9F?= <luise.quoss@idiv.de>
Date: Mon, 14 Mar 2022 12:30:14 +0100
Subject: [PATCH] add file encoding

---
 ebv_metadata_app.R | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/ebv_metadata_app.R b/ebv_metadata_app.R
index 313876f..8ea3e40 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))
           }
 
 
-- 
GitLab