Fix stringToUTF8Array

This commit is contained in:
Simon Kornblith 2012-04-10 20:00:54 -04:00
parent 1585ece566
commit a926259d31

View file

@ -1515,14 +1515,14 @@ Zotero.Utilities = {
var val = string.charCodeAt(i);
if(val >= 128) {
if(val >= 2048) {
array[offset] = ((val >>> 6) | 192);
array[offset+1] = (val & 63) | 128;
offset += 2;
} else {
array[offset] = (val >>> 12) | 224;
array[offset+1] = ((val >>> 6) & 63) | 128;
array[offset+2] = (val & 63) | 128;
offset += 3;
} else {
array[offset] = ((val >>> 6) | 192);
array[offset+1] = (val & 63) | 128;
offset += 2;
}
} else {
array[offset++] = val;