Android Question Charset and SMS

lemonisdead

Well-Known Member
Licensed User
Longtime User
Hi,

Please, do you have any tip to detect a string's charset ? This to be able to convert or filter the content of a message which will be sent via SMS.

My need : I have to send by SMS, a message which content is provided by an external device. It's length can change. So I split the content by packets of 160 chars and send them. I have tried Erel's sample too.

But sometimes, one SMS is not send. I think to have detected that the message contains some accented characters. On some devices, the same SMS is sent but other phones won't send it. So, I guess that the number of characters for each SMS depends on the original message's encoding.

I already have tried to filter using GetBytes and reencode with BytesToString but with no luck (I could have not understood the use).

Thanks a lot :)
 
Last edited:

lymey

Active Member
Licensed User
Longtime User
Hi,

Please, do you have any tip to detect a string's charset ? This to be able to convert or filter the content of a message which will be sent via SMS.

My need : I have to send by SMS, a message which content is provided by an external device. It's length can change. So I split the content by packets of 160 chars and send them. I have tried Erel's sample too.

But sometimes, one SMS is not send. I think to have detected that the message contains some accented characters. On some devices, the same SMS is sent but other phones won't send it. So, I guess that the number of characters for each SMS depends on the original message's encoding.

I already have tried to filter using GetBytes and reencode with BytesToString but with no luck (I could have not understood the use).

Thanks a lot :)


Optional: Do you know how some applications are able to send multiple SMS text that fall into one when received ?
You are right - message length varies depending on the characters/alphabet used, you can find out more here (and other places on the net):
http://en.wikipedia.org/wiki/Short_Message_Service
Message size
Transmission of short messages between the SMSC and the handset is done whenever using the Mobile Application Part (MAP) of the SS7 protocol.[39] Messages are sent with the MAP MO- and MT-ForwardSM operations, whose payload length is limited by the constraints of the signaling protocol to precisely 140 octets (140 octets * 8 bits / octet = 1120 bits). Short messages can be encoded using a variety of alphabets: the default GSM 7-bit alphabet, the 8-bit data alphabet, and the 16-bit UCS-2 alphabet.[40] Depending on which alphabet the subscriber has configured in the handset, this leads to the maximum individual short message sizes of 160 7-bit characters, 140 8-bit characters, or 70 16-bit characters. GSM 7-bit alphabet support is mandatory for GSM handsets and network elements,[40] but characters in languages such as Arabic, Chinese, Korean, Japanese, or Cyrillic alphabet languages (e.g., Russian, Serbian, Bulgarian, etc.) must be encoded using the 16-bit UCS-2 character encoding (see Unicode). Routing data and other metadata is additional to the payload size.

Larger content (concatenated SMS, multipart or segmented SMS, or "long SMS") can be sent using multiple messages, in which case each message will start with a User Data Header (UDH) containing segmentation information. Since UDH is part of the payload, the number of available characters per segment is lower: 153 for 7-bit encoding, 134 for 8-bit encoding and 67 for 16-bit encoding. The receiving handset is then responsible for reassembling the message and presenting it to the user as one long message. While the standard theoretically permits up to 255 segments,[41] 6 to 8 segment messages are the practical maximum, and long messages are often billed as equivalent to multiple SMS messages. Some providers have offered length-oriented pricing schemes for messages, however, the phenomenon is disappearing.
 
Upvote 0
Top