From fab80c872af697d61f200fd410a7ecc64ca0a537 Mon Sep 17 00:00:00 2001
From: ulrich <undisclosed>
Date: Mon, 06 Mar 2017 22:59:47 +0000
Subject: [PATCH] dekodieren fuer Codemirror

---
 web/ui/ui.js |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/web/ui/ui.js b/web/ui/ui.js
index ddf9e16..a05b1bb 100644
--- a/web/ui/ui.js
+++ b/web/ui/ui.js
@@ -761,7 +761,9 @@
       }
     }
   });
-  cm.setValue(htmlDecode(content));
+  //cm.setValue(htmlDecode(content));
+  //cm.setValue(content);
+  cm.setValue(unescapeHtml(content));
 }
 
 
@@ -804,6 +806,31 @@
   return '{"' + obj.constructor.name + '":' + JSON.stringify(obj) + '}';
 }
 
+function escapeHtml(text) {
+  text = text.replace(/\u228/g,'&auml;');
+  text = text.replace(/\u246/g,'&ouml;');
+  text = text.replace(/\u252/g,'&uuml;');
+  text = text.replace(/\u196/g,'&Auml;');
+  text = text.replace(/\u214/g,'&Ouml;');
+  text = text.replace(/\u220/g,'&Uuml;');
+  text = text.replace(/\u223/g,'&szlig;');
+  text = text.replace(/\u26/g,'&amp;');
+  return text;
+}
+
+function unescapeHtml(text) {
+  text = text.replace(/&auml;/g, String.fromCharCode(228));
+  text = text.replace(/&ouml;/g, String.fromCharCode(246));
+  text = text.replace(/&uuml;/g, String.fromCharCode(252));
+  text = text.replace(/&Auml;/g, String.fromCharCode(196));
+  text = text.replace(/&Ouml;/g, String.fromCharCode(214));
+  text = text.replace(/&Uuml;/g, String.fromCharCode(220));
+  text = text.replace(/&szlig;/g, String.fromCharCode(223));
+  text = text.replace(/&amp;/g, String.fromCharCode(26));
+  return text;
+}
+
+
 /* ----- Objekte ----- */
 
 function FileList(fl) {

--
Gitblit v1.9.3