adding UTF-16 for Arabic language and others

Nov 29, 2011 at 5:27 PM

dear bentesha

I faced problem in SMSCDefaultEncoding Class, I got an Error says: index out of rang, 

 for (index = 0; index < vDefaultForwardTable.Length; ++index)
            {
                vDefaultReverseTable[vDefaultForwardTable[index]] = (byte)index;
            } 

therefore, I'm planning to add UTF-16 to DataCoding class as:

case DataCoding.UTF16:
         result = System.Text.Encoding.BigEndianUnicode.GetString(data);
break;

this addition is working fine and the arabic now is supported.

now i need to know how  can i set the default encoding to the whole lib to be utf16 for both transmitter and receiver   

Coordinator
Dec 3, 2011 at 6:38 PM

fawazalshamri,

I need to know which lib you are using. Are you using the base library or the wrapper library to send messages?

If you are using the SmppClient class to send/receive messages, then you can set default encoding for outgoing messages as follows:

 

SmppClient client = new SmppClient();
client.Properties.DefaultEncloding = /*Your default encoding value*/;

 

However, this will only apply for outgoing messages. Incoming PDU's have encoding property specified, which is what the SmppClient uses to decode a message.

Hope this helps,

Ben

Dec 5, 2011 at 1:03 PM

thank you ben, it's working

properties.DefaultEncoding = DataCoding.UTF16

 and the smsc defualt encoding is Unicode, so,i use this for the incomming PDU

 

case DataCoding.UTF16:
case DataCoding.UCS2:
        result = System.Text.Encoding.BigEndianUnicode.GetString(data);
break;
------------------------------------------------------------------------

 

i couldn't understand this function GetMaxMessageLength in TextMessage class
this is in  JamaaTech.Smpp.Net.Client namespace, 

 

        private static int GetMaxMessageLength(DataCoding encoding, bool includeUdh)
        {
            switch (encoding)
            {
                case DataCoding.SMSCDefault:
                    return includeUdh ? 153 : 160;
                case DataCoding.Latin1:
                    return includeUdh ? 134 : 140;
                case DataCoding.ASCII:
                    return includeUdh ? 153 : 160;
                case DataCoding.UCS2:
                    return includeUdh ? 67 : 70;
                case DataCoding.UTF16:
                    return 224;                   
                default:
                    throw new InvalidOperationException("Invalid or unsuported encoding for text message ");
            }
        }

I have Some question: 
whay you use the case statement in a function, and what is the includeUdh , for testing,the UTF16 return 224.
I note that the smpp does not support sending concatenated messages, therefore, could you please tell me why do you not supporting the concatenated  messages,I want to modifiy the smpp lip to support sending concatenated messages, after that I will testing the smpp in a live smsc ,becaus the smsc is supporting concatenated  messages, could you please tell me what is the functions that I can Start with.

 

Coordinator
Dec 5, 2011 at 2:12 PM

For Unicode encoding, you should return a value similar to UCS2 encoding, and not 224.

The max message size is 160 for 7 bit encoding schemes.

If a UDH field is included, the total number of bytes that can be sent is reduced by 6 bytes (6 characters for 7 or 8 bit encoding and 3 characters for Unicode encoding).

So, try to make you code look something like the following:

 

case DataCoding.UCS2:
case DataCoding.UTF16:
	return includeUdh ? 67 : 70;
case . . . . 

 

In fact, the base SMPP lib supports concatenated messages. You need to set the UDH with correct parameters. Please refer to the SMPP protocol ver 3.4

There is also a thread in the discussion list for concatenated messages. It should be helpful for you case.

Please don't forget to rate our library.

Hope that helps.

Ben

Jul 15, 2014 at 1:47 AM
Dears,
I need help regarding the same topic. I have to send arabic SMS and on changing of encoding type. it always send the special characters. I am new to SMPP and is trying to use it in one of our projects.
I had tried all the solutions across web like :-http://stackoverflow.com/questions/874321/how-to-send-an-sms-in-hebrew-with-clickatell

However, I am still not able to figure out how to solve it.

Please direct me to the solution.

Thanks in advance.

Tanzeel