TOC html

From Redazione
Jump to navigation Jump to search
Line 55: Line 55:
 
$ci(function() {
 
$ci(function() {
  
 +
// https://stackoverflow.com/questions/25003217/using-encodeuri-vs-escape-for-utf-8-strings-in-javascript
 +
var utf8_to_latin1 = function (s) {
 +
    return unescape(encodeURIComponent(s));
 +
};
 +
var latin1_to_utf8 = function (s) {
 +
    return decodeURIComponent(escape(s));
 +
};
  
 
var wiki_list = []
 
var wiki_list = []
Line 94: Line 101:
 
var contents = $ci('#TOC_contents').val();
 
var contents = $ci('#TOC_contents').val();
  
contents = decodeURIComponent(escape(window.atob(contents)));
+
contents = latin1_to_utf8(window.atob(contents));
  
 
if(contents) {
 
if(contents) {
Line 127: Line 134:
 
walk_through_TOC(index_obj_saved,null,0);
 
walk_through_TOC(index_obj_saved,null,0);
  
index_obj_saved = btoa(encodeURIComponent(JSON.stringify(index_obj_saved)));
+
index_obj_saved = utf8_to_latin1(JSON.stringify(index_obj_saved));
  
$ci('#TOC_contents').val(index_obj_saved)
+
$ci('#TOC_contents').val(btoa(index_obj_saved))
  
  

Revision as of 15:59, 17 July 2020

tree placeholder