From 1cb83df86619571bce7c9a598e90a71ecdf362cd Mon Sep 17 00:00:00 2001 From: deuce <> Date: Sat, 20 Mar 2010 01:17:18 +0000 Subject: [PATCH] Fix UTF-8 decoding. --- src/ZuulTerm/chrome/content/Util.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ZuulTerm/chrome/content/Util.js b/src/ZuulTerm/chrome/content/Util.js index a8d6bd756a..8440cdd3c5 100644 --- a/src/ZuulTerm/chrome/content/Util.js +++ b/src/ZuulTerm/chrome/content/Util.js @@ -45,28 +45,28 @@ function decode(encoded) var val=0xfffd; var firstbyte=encoded.charCodeAt(0); - if(firstbyte & 0xe0 == 0xd0) { + if((firstbyte & 0xe0) == 0xc0) { bytes=2; val=firstbyte & 0x1f; } - else if(firstbyte & 0xf0 == 0xe0) { + else if((firstbyte & 0xf0) == 0xe0) { bytes=3; val=firstbyte & 0x0f; } - else if(firstbyte & 0xf8 == 0xf0) { + else if((firstbyte & 0xf8) == 0xf0) { bytes=4; val=firstbyte & 0x07; } - else if(firstbyte & 0xfc == 0xf8) { + else if((firstbyte & 0xfc) == 0xf8) { bytes=5; val=firstbyte & 0x03; } - else if(firstbyte & 0xfe == 0xfc) { + else if((firstbyte & 0xfe) == 0xfc) { bytes=6; val=firstbyte & 0x01; } for(i=1; i<bytes; i++) { - if(encoded.charCodeAt(i) & 0xc0 != 0x80) { + if((encoded.charCodeAt(i) & 0xc0) != 0x80) { val = 0xfffd; break; } -- GitLab