From ca0cd05973b468c056a682ab1fb9133856a56943 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Mon, 28 Nov 2011 03:10:44 -0500
Subject: [PATCH] - Fix handling HTML entities when converting HTML to text (#1488212)

---
 program/js/app.js |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index 22ff4c9..f17e2f4 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -5765,10 +5765,13 @@
     });
   };
 
-  this.plain2html = function(plainText, id)
+  this.plain2html = function(plain, id)
   {
     var lock = this.set_busy(true, 'converting');
-    $('#'+id).val(plainText ? '<pre>'+plainText+'</pre>' : '');
+
+    plain = plain.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
+    $('#'+id).val(plain ? '<pre>'+plain+'</pre>' : '');
+
     this.set_busy(false, null, lock);
   };
 

--
Gitblit v1.9.1