Hi, 

Using CVS version of kannel (updated a few minutes ago)...

We found that the SMPP smsc module did not correctly charset encode a long
text message that was automatically split by kannel / smsbox according to:

concatenation = yes

At a glance, I do not think this code rearrangement should have any adverse
effects, except if msg->SMS.msgdata is presumed to be exactly what the user
sent in later on in code (because this patch will charset encode the user's
data in place -- which could be considered bad behaviour).

Find patch attached anyway. Comments?

For an example of the problem, try sending the following message using
kannel from CVS:




[EMAIL PROTECTED]&*()-=_+[]{};':",.There are places I'll remember
All my life though some have changed.
Some forever not for better
Some have gone and some remain.
All these places had their moments
With lovers and friends I still recall.
Some are dead and some are living,
In my life I've loved them all.

But of all these friends and lovers,





-- 
Benjamin Lee

Level 2 71-75 City Rd, South Melbourne, VIC 3006 Australia
Phone +61 3 8699 1333  Mobile +61 414 717 573  Fax +61 3 8699 1388
Index: gw/smsc/smsc_smpp.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_smpp.c,v
retrieving revision 1.28
diff -u -r1.28 smsc_smpp.c
--- gw/smsc/smsc_smpp.c 4 Mar 2003 15:16:09 -0000       1.28
+++ gw/smsc/smsc_smpp.c 6 Mar 2003 02:37:02 -0000
@@ -409,6 +409,28 @@
         pdu->u.submit_sm.esm_class = pdu->u.submit_sm.esm_class |
             ESM_CLASS_SUBMIT_RPI;
 
+    /* 
+     * only re-encoding if using default smsc charset that is defined via 
+     * alt-charset in smsc group and if MT is not binary
+     */
+
+    if (pdu->u.submit_sm.data_coding == 0) {
+               
+        /* 
+         * convert to the given alternative charset
+         * otherwise assume to convert to GSM 03.38 7-bit alphabet
+         */
+        if (smpp->alt_charset) {
+            if (charset_convert(msg->sms.msgdata, "ISO-8859-1",
+                                octstr_get_cstr(smpp->alt_charset)) != 0)
+                error(0, "Failed to convert msgdata from charset <%s> to <%s>, will 
send as is.", 
+                         "ISO-8859-1", octstr_get_cstr(smpp->alt_charset));
+        } else {
+            charset_latin1_to_gsm(msg->sms.msgdata);            
+        }
+    } 
+
+               
     /*
      * set data segments and length
      */
@@ -417,26 +439,6 @@
               octstr_format("%S%S", msg->sms.udhdata, msg->sms.msgdata); 
     } else { 
         pdu->u.submit_sm.short_message = octstr_duplicate(msg->sms.msgdata); 
-
-        /* 
-         * only re-encoding if using default smsc charset that is defined via 
-         * alt-charset in smsc group and if MT is not binary
-         */
-        if (pdu->u.submit_sm.data_coding == 0) {
-            
-            /* 
-             * convert to the given alternative charset
-             * otherwise assume to convert to GSM 03.38 7-bit alphabet
-             */
-            if (smpp->alt_charset) {
-                if (charset_convert(pdu->u.submit_sm.short_message, "ISO-8859-1",
-                                    octstr_get_cstr(smpp->alt_charset)) != 0)
-                    error(0, "Failed to convert msgdata from charset <%s> to <%s>, 
will send as is.", 
-                             "ISO-8859-1", octstr_get_cstr(smpp->alt_charset));
-            } else {
-                charset_latin1_to_gsm(pdu->u.submit_sm.short_message);          
-            }
-        } 
     }
     pdu->u.submit_sm.sm_length = octstr_len(pdu->u.submit_sm.short_message);
 

Reply via email to