Decode from UTF8 before display
authorJoey Schulze <joey@infodrom.org>
Wed, 28 Oct 2015 11:22:09 +0000 (11:22 +0000)
committerJoey Schulze <joey@infodrom.org>
Wed, 28 Oct 2015 11:22:09 +0000 (11:22 +0000)
src/InfoCon/account/list.wml

index 7bbbfa3..d9d48a2 100644 (file)
@@ -159,6 +159,26 @@ $(function(){
     $('body').append('<script type="text/javascript" src="../../jquery.event.ue.js"><\/script>');
 });
 
+//+ Jonas Raoni Soares Silva
+//@ http://jsfromhell.com/geral/utf-8 [rev. #1]
+
+UTF8 = {
+        encode: function(s){
+                for(var c, i = -1, l = (s = s.split("")).length, o = String.fromCharCode; ++i < l;
+                        s[i] = (c = s[i].charCodeAt(0)) >= 127 ? o(0xc0 | (c >>> 6)) + o(0x80 | (c & 0x3f)) : s[i]
+                );
+                return s.join("");
+        },
+        decode: function(s){
+                for(var a, b, i = -1, l = (s = s.split("")).length, o = String.fromCharCode, c = "charCodeAt"; ++i < l;
+                        ((a = s[i][c](0)) & 0x80) &&
+                        (s[i] = (a & 0xfc) == 0xc0 && ((b = s[i + 1][c](0)) & 0xc0) == 0x80 ?
+                        o(((a & 0x03) << 6) + (b & 0x3f)) : o(128), s[++i] = "")
+                );
+                return s.join("");
+        }
+};
+
 function filter_popup()
 {
     if (!$('#filter_popup form input').length) {
@@ -182,7 +202,7 @@ function filter_popup()
                      $.post('list.php',
                             'ajax=1&'+$('#filter_popup form').serialize(),
                             function(data){
-                                $('table.border tbody').html(data);
+                                $('table.border tbody').html(UTF8.decode(data));
                             });
                      return false;
                  });
@@ -191,7 +211,7 @@ function filter_popup()
                      $.post('list.php',
                             'ajax=1&'+$('#filter_popup form').serialize(),
                             function(data){
-                                $('table.border tbody').html(data);
+                                $('table.border tbody').html(UTF8.decode(data));
                                 $('#filter_popup').hide();
                             });
                      return false;