TwilioDevEd / message-segment-calculator

JS-based tool to calculate and display message segmentation data for a given message body
https://twiliodeved.github.io/message-segment-calculator/
MIT License
85 stars 35 forks source link

Can't force encoding to "UCS-2" #29

Closed vdupin closed 1 year ago

vdupin commented 2 years ago

Hello,

The following code return a GSM-7 encoding message :

const message = new SegmentedMessage("abc", 'UCS-2')

image

Would it be possible to add the possibility to force encoding?

Example of encountered problem, the following codes are equal:

new SegmentedMessage(']]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]', 'UCS-2').segmentsCount new SegmentedMessage(']]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]', 'GSM-7').segmentsCount

Thank you

hughrawlinson commented 1 year ago

Hi! We're not able to reproduce your issue. When we provide 'UCS-2' as the encoding, we get 2 segments. It might be that one of the commits since you filed your issue has fixed it. Please let us know if you can still reproduce your issue with the latest release.

Additionally, in your issue you reference the segmentsCount object - this is undefined on both SegmentedMessage objects. We checked segments.length and found that they showed the correct number of segments for each encoding.