Skip to content

Commit 206ea89

Browse files
Fix: incorrect string length when emitting descriptors with non-latin characters (#758) (#761)
(cherry picked from commit 06528b9) Co-authored-by: William Belcher <william.belcher@hotmail.com>
1 parent c4df4f2 commit 206ea89

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Frontend/library/src/UeInstanceMessage/SendMessageController.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export class SendMessageController {
6262
}
6363

6464
let byteLength = 0;
65-
const textEncoder = new TextEncoder();
6665
// One loop to calculate the length in bytes of all of the provided data
6766
messageData.forEach((element: number | string, idx: number) => {
6867
const type = messageFormat.structure[idx];
@@ -90,8 +89,8 @@ export class SendMessageController {
9089
case 'string':
9190
// 2 bytes for string length
9291
byteLength += 2;
93-
// 2 bytes per characters
94-
byteLength += 2 * textEncoder.encode(element as string).length;
92+
// 2 bytes per character
93+
byteLength += 2 * (element as string).length;
9594
break;
9695
}
9796
});

0 commit comments

Comments
 (0)