All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] stkutil: Use sms_dcs_decode to retrieve the STK character set.
@ 2010-11-25 16:15 Lucas, GuillaumeX
  2010-11-26  0:00 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Lucas, GuillaumeX @ 2010-11-25 16:15 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1652 bytes --]

From: Guillaume Lucas <guillaumex.lucas@intel.com>

---
 src/stkutil.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index 377ceff..78efbf0 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -77,9 +77,13 @@ struct gsm_sms_tpdu {
 static char *decode_text(unsigned char dcs, int len, const unsigned char *data)
 {
 	char *utf8;
+	enum sms_charset charset;
 
-	switch (dcs) {
-	case 0x00:
+	if (!sms_dcs_decode(dcs, NULL, &charset, NULL, NULL))
+		return NULL;
+
+	switch (charset) {
+	case SMS_CHARSET_7BIT:
 	{
 		long written;
 		unsigned long max_to_unpack = len * 8 / 7;
@@ -94,10 +98,10 @@ static char *decode_text(unsigned char dcs, int len, const unsigned char *data)
 		g_free(unpacked);
 		break;
 	}
-	case 0x04:
+	case SMS_CHARSET_8BIT:
 		utf8 = convert_gsm_to_utf8(data, len, NULL, NULL, 0);
 		break;
-	case 0x08:
+	case SMS_CHARSET_UCS2:
 		utf8 = g_convert((const gchar *) data, len,
 					"UTF-8//TRANSLIT", "UCS-2BE",
 					NULL, NULL, NULL);
-- 
1.7.0.4

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-26  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-25 16:15 [PATCH] stkutil: Use sms_dcs_decode to retrieve the STK character set Lucas, GuillaumeX
2010-11-26  0:00 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.