Open
Description
Issue Description
The textDecoder has strange behavior when working with cbor
data.
In node, it is working as expected but in nativescript the TextDecoder returns a strange format:
More info:
Issue in node-cbor
Reproduction
https://github.com/abdallahkadour/cbor-node-ns-example
A code snippet will be executed in the app component.
clone and
$ns run ios
It executes the code:
import * as process from "process";
global.process = process;
import * as prereqs from "cbor-rn-prereqs";
import * as cbor from "cbor";
let object = {
"1": "DE",
"6": 1622316073,
"4": 1643356073,
};
console.log(
"The object ",
object,
" Will be encoded and decoded using cbor"
);
let encoded = cbor.encode(object);
console.log("The encode object hex ", encoded.toString("hex"));
console.log("The encode object ", encoded);
let decoded = cbor.decode(encoded);
let decodedString = JSON.stringify(decoded);
console.log("the decoded string", decodedString);
Relevant log output (if applicable)
The decoded object should be `{
"1": "DE",
"6": 1622316073,
"4": 1643356073,
};`