From 2b5f325a8b13d115fffd9432c5183164d380bf64 Mon Sep 17 00:00:00 2001 From: Lapo Luchini Date: Sat, 13 Jul 2019 09:48:19 +0000 Subject: [PATCH] Translate into hex to make bit comparison more clear. --- asn1.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/asn1.js b/asn1.js index 0a843fa..a820ce5 100644 --- a/asn1.js +++ b/asn1.js @@ -101,9 +101,9 @@ Stream.prototype.parseStringUTF = function (start, end) { var s = ""; for (var i = start; i < end; ) { var c = this.get(i++); - if (c < 128) + if (c < 0x80) s += String.fromCharCode(c); - else if ((c > 191) && (c < 224)) + else if ((c >= 0xC0) && (c < 0xE0)) s += String.fromCharCode(((c & 0x1F) << 6) | (this.get(i++) & 0x3F)); else s += String.fromCharCode(((c & 0x0F) << 12) | ((this.get(i++) & 0x3F) << 6) | (this.get(i++) & 0x3F)); -- 2.51.2