From 1d665857ebfddd4e8783938254ef1258e915664e Mon Sep 17 00:00:00 2001 From: Rolaka Date: Fri, 10 Apr 2020 09:52:28 +0800 Subject: [PATCH] fix UTF8 bug --- lib/eml-format.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/eml-format.js b/lib/eml-format.js index 575e557..2ceef22 100644 --- a/lib/eml-format.js +++ b/lib/eml-format.js @@ -173,10 +173,10 @@ var emlformat = { //Convert =0D to '\r', =20 to ' ', etc. if (!charset || charset == "utf8" || charset == "utf-8") { return s + .replace(/=\r?\n/gi, "") //Join line .replace(/=([\w\d]{2})=([\w\d]{2})=([\w\d]{2})/gi, function(matcher, p1, p2, p3, offset, string) { return Buffer.from([ parseInt(p1, 16), parseInt(p2, 16), parseInt(p3, 16) ]).toString("utf8"); }) .replace(/=([\w\d]{2})=([\w\d]{2})/gi, function(matcher, p1, p2, offset, string) { return Buffer.from([ parseInt(p1, 16), parseInt(p2, 16) ]).toString("utf8"); }) - .replace(/=([\w\d]{2})/gi, function(matcher, p1, offset, string) { return String.fromCharCode(parseInt(p1, 16)); }) - .replace(/=\r?\n/gi, ""); //Join line + .replace(/=([\w\d]{2})/gi, function(matcher, p1, offset, string) { return String.fromCharCode(parseInt(p1, 16)); }); } else { return s