Skip to content

Commit 9d32276

Browse files
authored
Merge pull request #14 from TwilioDevEd/hot-fix
fix: Bug in calculating one char UCS-2
2 parents a898bf0 + f489fa2 commit 9d32276

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)