-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
It seems that readAsString method is not handling utf-8 characters that are out of ascii range correctly, for example: '°C' is interpreted as '°C'. I propose replacing implementation of readAsString:
readAsString: {
value: function() {
var buffer = this.buffer;
var charCount = buffer.byteLength;
var charSize = 1;
var byteCount = charCount * charSize;
var bufferView = new DataView(buffer);
var charCodes = [];
for (var i = 0; i < charCount; ++i) {
var charCode = bufferView.getUint8(i * charSize, true);
charCodes.push(charCode);
}
return (this._string = String.fromCharCode.apply(null, charCodes));
}
method with following line:
readAsString: {
value: function() {
return new TextDecoder().decode(this.buffer);
}
BR,
Dariusz
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels