tradegeek+
2017-02-09 00:08:11 UTC
Hi,
I'm unable to successfully encode/decode an SMS containing emoji.
Using Python 3 and the Python-Gammu library, I encode a PDU for message
text containing an emoji character 😂 (Unicode character U+1F602 -
"FACE WITH TEARS OF JOY"):
The PDU returned is "07918188558588f811000b912121551532f40018ff02f602".
When I then decode this PDU using the Python-Gammu library, the message
text contains an unrecognised character  (\xEF\x98\x82), rather than
the Unicode emoji character.
*** I get the same result using Wammu's own encoder and decoder tools at
https://wammu.eu/tools/pdu-encode/ and
https://wammu.eu/tools/pdu-decode/ . ***
I wonder whether this is something to do with the gammu library working
strictly to the GSM specification and interpreting the UDH payload as
UCS-2 encoded rather than as UTF-16. Nevertheless, emoji are now in
common use within SMS messages, and I need to find a way of converting
gammu's literal decoding back to the original emoji as entered by the
sending party.
Would anyone please be able to guide me on how to achieve this?
Thanks, David.
I'm unable to successfully encode/decode an SMS containing emoji.
Using Python 3 and the Python-Gammu library, I encode a PDU for message
text containing an emoji character 😂 (Unicode character U+1F602 -
"FACE WITH TEARS OF JOY"):
The PDU returned is "07918188558588f811000b912121551532f40018ff02f602".
When I then decode this PDU using the Python-Gammu library, the message
text contains an unrecognised character  (\xEF\x98\x82), rather than
the Unicode emoji character.
*** I get the same result using Wammu's own encoder and decoder tools at
https://wammu.eu/tools/pdu-encode/ and
https://wammu.eu/tools/pdu-decode/ . ***
I wonder whether this is something to do with the gammu library working
strictly to the GSM specification and interpreting the UDH payload as
UCS-2 encoded rather than as UTF-16. Nevertheless, emoji are now in
common use within SMS messages, and I need to find a way of converting
gammu's literal decoding back to the original emoji as entered by the
sending party.
Would anyone please be able to guide me on how to achieve this?
Thanks, David.