Skip to content

Commit f489fa2

Browse files
author
Giuseppe Verni
committed
fix: Bug in calculating one char UCS-2
1 parent a898bf0 commit f489fa2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libs/SegmentedMessage.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import GraphemeSplitter from 'grapheme-splitter';
22

33
import Segment from './Segment';
44
import EncodedChar from './EncodedChar';
5+
import UnicodeToGsm from './UnicodeToGSM';
56

67
type SmsEncoding = 'GSM-7' | 'UCS-2';
78

@@ -91,7 +92,7 @@ export class SegmentedMessage {
9192
_hasAnyUCSCharacters(graphemes: string[]): boolean {
9293
let result = false;
9394
for (const grapheme of graphemes) {
94-
if (grapheme.length >= 2) {
95+
if (grapheme.length >= 2 || (grapheme.length === 1 && !UnicodeToGsm[grapheme.charCodeAt(0)])) {
9596
result = true;
9697
break;
9798
}

0 commit comments

Comments
 (0)