Skip to content

[feature request] Add support for UCS-2 encoded SMS #11

Description

@dscp46

Hi,

When UCS-2 encoded SMS are received, the text variable is empty, and replaced by ucs-2 in the json payload.

Here is a sample message extracted with the uqmi -s -d $device --get-message $messageID --storage $storage command (sensitive data redacted):

{"smsc":"+336xxxxxxxx","sender":"Free Mobile","timestamp":"2024-02-20 20:58:04","concat_ref":67,"concat_part":4,"concat_parts":4,"ucs-2":"00200070006100730073006500200064006500200076006f0074007200650020004500730070006100630065002000410062006f006e006e00e900200065007400200063006f006e00740061006300740065007a002d006e006f0075007300200061007500200033003200340034002e"}

As a custom fix, I've added the following lines between fi and echo "$sender" > $receiveFolder/$sms_file in /usr/bin/uqmi_d.sh:

if [ ! -n "$text" ]
then
	json_get_var ucs_2 ucs-2
	text=$(echo $ucs_2 | sed -r 's/00([0-9a-f][0-9a-f])/\1/g' | xxd -r -p)
fi 

It's a quick and ugly fix as it depends on xxd, which is not part of your dependencies, and the charset conversion is not done in a proper way.

Kind regards,

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions