Skip to content

Commit

Permalink
Merge pull request #269 from ifpen/isue_268
Browse files Browse the repository at this point in the history
fix bug in properly handling characters for JSON parsing #268
  • Loading branch information
bengaid committed Apr 8, 2024
2 parents 13923bd + ec1857f commit 23c821b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion front-end/source/kernel/runtime/xdash-runtime-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ var RuntimeDashboard = (function () {
}

async function loadDashboard(jsonContent, exportOptions) {
var decodedData = $('<textarea />').html(JSON.stringify(jsonContent.data)).text(); // MBG : find a better method
let decodedData = JSON.stringify(jsonContent.data); // fix bug in properly handling characters for JSON parsing
decodedData = decodedData.replace(/[\u007F-\uFFFF]/g, function (chr) {
return '\\u' + ('0000' + chr.charCodeAt(0).toString(16)).substr(-4);
});
var data_json = '';
try {
data_json = JSON.parse(decodedData);
Expand Down

0 comments on commit 23c821b

Please sign in to comment.