From 895c1dd2954058ab85287ac5c9c9d09e09166da8 Mon Sep 17 00:00:00 2001 From: Izzy <360964+izzy@users.noreply.github.com> Date: Sat, 23 Oct 2021 23:20:58 +0200 Subject: [PATCH] Fixed unicode incompatibilites in quoted printable decode --- CHANGELOG.md | 2 ++ js/D3.js | 16 +++++++--------- manifest.json | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9acf24..6b97dea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ CHANGELOG ============================= +* 4.9.0 + * Upgraded quoted printable decode to newer version * 4.8.0 * Upgraded unserialize to newer version * 4.7.0 diff --git a/js/D3.js b/js/D3.js index d7ef970..241eb73 100644 --- a/js/D3.js +++ b/js/D3.js @@ -706,15 +706,13 @@ var D3 = return temp.toLowerCase(); }, quoted_printable_decode: function (str) { - var RFC2045Decode1 = /=\r\n/gm, - // Decodes all equal signs followed by two hex digits - RFC2045Decode2IN = /=([0-9A-F]{2})/gim, // the RFC states against decoding lower case encodings, but following apparent PHP behavior - // RFC2045Decode2IN = /=([0-9A-F]{2})/gm, - - RFC2045Decode2OUT = function (sMatch, sHex) { - return String.fromCharCode(parseInt(sHex, 16)); - }; - return str.replace(RFC2045Decode1, '').replace(RFC2045Decode2IN, RFC2045Decode2OUT); + const RFC2045Decode1 = /=\r\n/gm; + const RFC2045Decode2IN = /=([0-9A-F]{2})/gim; + const RFC2045Decode2OUT = function (sMatch, sHex) { + return String.fromCharCode(parseInt(sHex, 16)); + } + + return D3.utf8_decode(str.replace(RFC2045Decode1, '').replace(RFC2045Decode2IN, RFC2045Decode2OUT)); }, quoted_printable_encode: function (str) { var hexChars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'], diff --git a/manifest.json b/manifest.json index 15c1fdc..6894136 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "__MSG_extName__", - "version": "4.8.0", + "version": "4.9.0", "description": "__MSG_extDescription__", "options_ui": { "page": "html/menu_ui.html",