Re: python-gammu - how do I encode/decode an SMS which contains emoji?

Michal Čihař <[email protected]> Fri, 10 Feb 2017 14:44:40 +0100
Newsgroups gmane.linux.drivers.gammu
Message-ID <[email protected]>
Hi

[email protected] píše v Čt 09. 02. 2017 v 00:08 +0000:
> 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?

This can be achieved by fixing bug in python-gammu :-). See our issue
tracker:

https://github.com/gammu/python-gammu/issues/16

-- 
	Michal Čihař | https://cihar.com/ | https://weblate.org/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

_______________________________________________
Gammu-users mailing list - https://lists.sourceforge.net/lists/listinfo/gammu-users
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEh+Zzr4P2w6DDRMjD9KoinU1YwkUFAlidw8gACgkQ9KoinU1Y
wkWC9g/+JTrr3Qih9vYKJUEbWil/roiy519FLOyrE+DnTgBaGVMGYLLVQ4/0Dn7Y
/UwjXfRA4wIPPTGdtoa/V3FZipyotlTCZDKe5zBr+OXpn+dQeeyw4jCW+ST8FOKU
fGP5/lRH4wvge2aqa73Ju0XkLbT+nbPT+CyiLpT+4Rgk9ByzVyEO8s8RrDT3wn2I
09c1Y2zbe6Mi4IYEqKsX5mOElS3TfHKsdvFr+5GSzsUC9ik1rgbezuj6y8DQLbi2
rPDyagVWMUKdvvo8iWUDoQDsovTstClA+eZA0sac8s2Z/0CzwL63Sw5q7cnwAAgE
isU82uQyMBzuoWlXdWl3cZ7z2bofJhRRYZqpA/+99y4XehBDQL4fN4cpWZP0jRoQ
saFCsBBrV02/Xg4RGy687kxZmp5ZG1KTGtNR+hgZfuVNudDti61pVeY7KAVCUDw+
3gWW4A8CVI2kpStnr36NBBuAhpgOuHOAXhp8ws27oMvpucuRU90/B2Vw2ohmmP5+
utyTziC8OsgYG8c+/HX+qgt3pnlUBc45eamE0MaF3Wer71wYOxPcNRpid+hYxWph
2Z6txyDSuwPyWEhFZJQdCeYNz2S27Ct50tqVwk1XL+6WEpiJ1D3X9pNZM3pTFS5K
kY42tOLP/2WtsxhpiLu/Yy+qlCDiKdIF64UtxE3GFMzodS9+rHA=
=AYxF
-----END PGP SIGNATURE-----