From 8cab6e94514c38151b2e0c53c9df47c6e1682e28 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Thu, 21 Jan 2021 19:21:56 +0000
Subject: [PATCH] Anpassungen Foto UI fertig, jQuery ausgebaut

---
 src/java/de/uhilger/filecms/api/FileMgr.java |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/java/de/uhilger/filecms/api/FileMgr.java b/src/java/de/uhilger/filecms/api/FileMgr.java
index 02a0029..3d6844f 100644
--- a/src/java/de/uhilger/filecms/api/FileMgr.java
+++ b/src/java/de/uhilger/filecms/api/FileMgr.java
@@ -38,8 +38,14 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
 import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.security.Principal;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -59,6 +65,7 @@
 import net.coobird.thumbnailator.Thumbnails;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.filefilter.WildcardFileFilter;
+import org.apache.commons.lang.StringEscapeUtils;
 
 /**
  * Methoden zur Verwaltung von Dateien
@@ -196,7 +203,7 @@
         try {
           File targetFile = new File(getTargetDir(relPath), fileName);
 
-          reader = new InputStreamReader(new FileInputStream(targetFile), "UTF8");
+          reader = new InputStreamReader(new FileInputStream(targetFile), Charset.forName("UTF-8").newDecoder());
           //reader = new FileReader(targetFile);
           StringBuffer buf = new StringBuffer();
           char[] readBuffer = new char[1024];
@@ -439,9 +446,11 @@
     FileRef savedFile = null;
     try {
       targetFile.createNewFile();
-      FileWriter w = new FileWriter(targetFile, Charset.forName("UTF-8"));
+      //FileWriter w = new FileWriter(targetFile, Charset.forName("UTF-8"));
       //w.write(StringEscapeUtils.unescapeHtml(contents));
-      w.write(contents);
+      Writer w = new OutputStreamWriter(new FileOutputStream(targetFile), "UTF-8");
+      //w.write(contents);
+      w.write(StringEscapeUtils.unescapeHtml(contents));
       w.flush();
       w.close();
       savedFile = new FileRef(

--
Gitblit v1.9.3