Fix unicode conversion

This commit is contained in:
Konrad Kosmatka
2024-01-23 13:07:25 +01:00
parent 2a7ff7797a
commit d3e013f604
+2 -3
View File
@@ -164,12 +164,11 @@ rdsparser.register_rt(rds, callbacks.rt);
rdsparser.register_ptyn(rds, callbacks.ptyn); rdsparser.register_ptyn(rds, callbacks.ptyn);
rdsparser.register_ct(rds, callbacks.ct); rdsparser.register_ct(rds, callbacks.ct);
const decode_unicode = function(string) const decode_unicode = function(string) {
{
let content = rdsparser.string_get_content(string); let content = rdsparser.string_get_content(string);
let length = rdsparser.string_get_length(string); let length = rdsparser.string_get_length(string);
let array = koffi.decode(content, koffi.array(unicode_type, length)); let array = koffi.decode(content, koffi.array(unicode_type, length));
return Buffer.from(array, 'utf-8').toString(); return String.fromCodePoint.apply(String, array);
}; };
const decode_errors = function(string) { const decode_errors = function(string) {