From 92d8a38ef62bdaee55a5d5d109ca22515fe215be Mon Sep 17 00:00:00 2001 From: Hugo Aboud Date: Thu, 16 Dec 2021 18:12:21 -0300 Subject: [PATCH] avoid utf-8 buffer re-decoding --- bits/40_harb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bits/40_harb.js b/bits/40_harb.js index fdf5f11..dd512e5 100644 --- a/bits/40_harb.js +++ b/bits/40_harb.js @@ -947,7 +947,7 @@ var PRN = (function() { default: throw new Error("Unrecognized type " + opts.type); } if(bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) str = utf8read(str.slice(3)); - else if(opts.type != 'string' && opts.codepage == 65001) str = utf8read(str); + else if(opts.type != 'string' && opts.type != 'buffer' && opts.codepage == 65001) str = utf8read(str); else if((opts.type == 'binary') && typeof cptable !== 'undefined' && opts.codepage) str = cptable.utils.decode(opts.codepage, cptable.utils.encode(28591,str)); if(str.slice(0,19) == "socialcalc:version:") return ETH.to_sheet(opts.type == 'string' ? str : utf8read(str), opts); return prn_to_sheet_str(str, opts);