You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The application is producing undecoded characters like šđćž due to an encoding error during JSON or HTML writing. The m2json.m file needs to be modified to ensure proper UTF-8 encoding before escaping special characters. The suggested solution is to add the unicode2native(val, 'UTF-8') function before line 43 in m2json.m.
I have resolved the issue. I used this function and call it
% plotly_aux/htmlencode.m
function encoded = htmlencode(str)
% Converts special characters to HTML entities
encoded = str;
% Basic HTML entities
encoded = strrep(encoded, '&', '&');
encoded = strrep(encoded, '<', '<');
encoded = strrep(encoded, '>', '>');
encoded = strrep(encoded, '"', '"');
encoded = strrep(encoded, '''', ''');
% Unicode handling: convert non-ASCII to &#xXXXX;
encoded = regexprep(encoded, '[^\x00-\x7F]', ...
'${sprintf(''&#x%04X;'', double($0))}');
end
so in m2jason.m
val = checkescape(val); % add escape characters
noTags = regexprep(val, '<[^>]+>', '');
val = htmlencode(noTags); % NEW: encode special/unicode chars
valstr = sprintf("""%s""", val);
in plotlyoffline.m
% handle plot div specs
noTags = regexprep(char(java.util.UUID.randomUUID), '<[^>]+>', '');
id = htmlencode(noTags);
The application is producing undecoded characters like šđćž due to an encoding error during JSON or HTML writing. The m2json.m file needs to be modified to ensure proper UTF-8 encoding before escaping special characters. The suggested solution is to add the
unicode2native(val, 'UTF-8')
function before line 43 inm2json.m
.The text was updated successfully, but these errors were encountered: