Skip to content

Commit

Permalink
Kattio: use Buffer.subarray instead of slice. explicitly use utf8
Browse files Browse the repository at this point in the history
  • Loading branch information
hieplpvip committed Jan 7, 2024
1 parent 627a634 commit adad330
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/kattio.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ const Kattio = {
if (!before) {
return this._buf.toString('utf8', start, this._bufPos);
}
var after = this._buf.slice(start, this._bufPos);
var after = this._buf.subarray(start, this._bufPos);
var res = Buffer.alloc(before.length + after.length);
before.copy(res);
after.copy(res, before.length);
return res.toString();
return res.toString('utf8');
},

nextToken: function () {
Expand Down

0 comments on commit adad330

Please sign in to comment.