<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:series="http://unfoldingneurons.com/"
		>
<channel>
	<title>Comments on: How to pack GSM-7 characters into septets</title>
	<atom:link href="http://mobiletidings.com/2009/07/06/how-to-pack-gsm7-into-septets/feed/" rel="self" type="application/rss+xml" />
	<link>http://mobiletidings.com/2009/07/06/how-to-pack-gsm7-into-septets/</link>
	<description>A blog about Internet protocols, mobile technologies and things remotely related</description>
	<lastBuildDate>Sun, 13 Nov 2011 12:43:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Florin</title>
		<link>http://mobiletidings.com/2009/07/06/how-to-pack-gsm7-into-septets/comment-page-2/#comment-3686</link>
		<dc:creator>Florin</dc:creator>
		<pubDate>Mon, 18 Apr 2011 11:42:44 +0000</pubDate>
		<guid isPermaLink="false">http://mobiletidings.com/?p=289#comment-3686</guid>
		<description>Hi everyone!

I have been reading these articles for a while and helped better understand the concatenation mechanism of an SMS.

I use the code below to create the UDH but it only works for UCS2 encoding. 
While I understand the need to add 1 bit when GSM7 encoding is used and the CSMS reference number is stored on 1 octet, I don&#039;t understand why the code below doesn&#039;t work (instead of 1 concatenated message I receive the parts separately on my mobile phone) when I used a CSMS reference number stored on 2 octets.

Here&#039;s the method I used to build the UDH. The parameters names are self-explanatory.

public byte[] BuildUDH(int CSMSRefNumber, int TotalParts, int PartNumber)
{
	byte[] udh= null;		
	if (_largeCSMSRefNumber)
	{
		udh = new byte[7];
		udh[0] = 0x6;
		udh[1] = 0x8;
		udh[2] = 0x4;
BitConverter.GetBytes((UInt16)CSMSRefNumber).CopyTo(udh, 3);
		udh[5] = (byte)TotalParts;
		udh[6] = (byte)PartNumber;
	}
	else
	{
		udh = new byte[6];					
		udh[0] = 0x5;
		udh[1] = 0x0; 
		udh[2] = 0x3;
		udh[3] = (byte)CSMSRefNumber;
		udh[4] = (byte)TotalParts;
		udh[5] = (byte)PartNumber;
			
	}					
return udh;
}

Thanks for any hint or advice you may have.
Cheers,
Florin</description>
		<content:encoded><![CDATA[<p>Hi everyone!</p>
<p>I have been reading these articles for a while and helped better understand the concatenation mechanism of an SMS.</p>
<p>I use the code below to create the UDH but it only works for UCS2 encoding.<br />
While I understand the need to add 1 bit when GSM7 encoding is used and the CSMS reference number is stored on 1 octet, I don&#8217;t understand why the code below doesn&#8217;t work (instead of 1 concatenated message I receive the parts separately on my mobile phone) when I used a CSMS reference number stored on 2 octets.</p>
<p>Here&#8217;s the method I used to build the UDH. The parameters names are self-explanatory.</p>
<p>public byte[] BuildUDH(int CSMSRefNumber, int TotalParts, int PartNumber)<br />
{<br />
	byte[] udh= null;<br />
	if (_largeCSMSRefNumber)<br />
	{<br />
		udh = new byte[7];<br />
		udh[0] = 0&#215;6;<br />
		udh[1] = 0&#215;8;<br />
		udh[2] = 0&#215;4;<br />
BitConverter.GetBytes((UInt16)CSMSRefNumber).CopyTo(udh, 3);<br />
		udh[5] = (byte)TotalParts;<br />
		udh[6] = (byte)PartNumber;<br />
	}<br />
	else<br />
	{<br />
		udh = new byte[6];<br />
		udh[0] = 0&#215;5;<br />
		udh[1] = 0&#215;0;<br />
		udh[2] = 0&#215;3;<br />
		udh[3] = (byte)CSMSRefNumber;<br />
		udh[4] = (byte)TotalParts;<br />
		udh[5] = (byte)PartNumber;</p>
<p>	}<br />
return udh;<br />
}</p>
<p>Thanks for any hint or advice you may have.<br />
Cheers,<br />
Florin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anil</title>
		<link>http://mobiletidings.com/2009/07/06/how-to-pack-gsm7-into-septets/comment-page-1/#comment-3538</link>
		<dc:creator>Anil</dc:creator>
		<pubDate>Sun, 06 Feb 2011 13:56:09 +0000</pubDate>
		<guid isPermaLink="false">http://mobiletidings.com/?p=289#comment-3538</guid>
		<description>I have make a project using vb for send conconated sms. It is working fine. But Problem is this, It is not send Unicode in Long Conconate SMS. Plz. help me for do this. Plz. tell me how to do this,  Plz..... With PDU Example</description>
		<content:encoded><![CDATA[<p>I have make a project using vb for send conconated sms. It is working fine. But Problem is this, It is not send Unicode in Long Conconate SMS. Plz. help me for do this. Plz. tell me how to do this,  Plz&#8230;.. With PDU Example</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Minhaj</title>
		<link>http://mobiletidings.com/2009/07/06/how-to-pack-gsm7-into-septets/comment-page-1/#comment-1627</link>
		<dc:creator>Minhaj</dc:creator>
		<pubDate>Fri, 18 Jun 2010 07:24:17 +0000</pubDate>
		<guid isPermaLink="false">http://mobiletidings.com/?p=289#comment-1627</guid>
		<description>My UDH is 
05 00 03 03 02 01
for first message</description>
		<content:encoded><![CDATA[<p>My UDH is<br />
05 00 03 03 02 01<br />
for first message</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Minhaj</title>
		<link>http://mobiletidings.com/2009/07/06/how-to-pack-gsm7-into-septets/comment-page-1/#comment-1626</link>
		<dc:creator>Minhaj</dc:creator>
		<pubDate>Fri, 18 Jun 2010 07:21:56 +0000</pubDate>
		<guid isPermaLink="false">http://mobiletidings.com/?p=289#comment-1626</guid>
		<description>Hello Every one ! 
Its been great to read this blog , I have an issue that I couldn&#039;t solve yet . I can not convert GSM-7 character est into septets , I need to know how this is done ?? please help me out , I need to know how this is done manually so that i could find out what am I doing wrong .

I have a text 
&quot;This is part 1.&quot;

when it is encoded without padding bits it has the following encoded hex values
54 74 7A 0E 4A CF 41 F0 B0 9C 0E 8A B9 00

but when with padding is used then it has the following hex pattern
A8 E8 F4 1C 94 9E 83 A0 61 39 1D 14 73 01


I can not convert from gsm-7 character set to gsm-7 character set with encoding , I need to know that how ths is done , I used this algorithm mentioned in this blog but it doesnt seem to be working for this , please help me out what I am missing 

Thanks in regards</description>
		<content:encoded><![CDATA[<p>Hello Every one !<br />
Its been great to read this blog , I have an issue that I couldn&#8217;t solve yet . I can not convert GSM-7 character est into septets , I need to know how this is done ?? please help me out , I need to know how this is done manually so that i could find out what am I doing wrong .</p>
<p>I have a text<br />
&#8220;This is part 1.&#8221;</p>
<p>when it is encoded without padding bits it has the following encoded hex values<br />
54 74 7A 0E 4A CF 41 F0 B0 9C 0E 8A B9 00</p>
<p>but when with padding is used then it has the following hex pattern<br />
A8 E8 F4 1C 94 9E 83 A0 61 39 1D 14 73 01</p>
<p>I can not convert from gsm-7 character set to gsm-7 character set with encoding , I need to know that how ths is done , I used this algorithm mentioned in this blog but it doesnt seem to be working for this , please help me out what I am missing </p>
<p>Thanks in regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Emil E</title>
		<link>http://mobiletidings.com/2009/07/06/how-to-pack-gsm7-into-septets/comment-page-1/#comment-1622</link>
		<dc:creator>Emil E</dc:creator>
		<pubDate>Wed, 02 Jun 2010 18:53:16 +0000</pubDate>
		<guid isPermaLink="false">http://mobiletidings.com/?p=289#comment-1622</guid>
		<description>Hi,
here is PDU to TXT

/*
GSM-7 packing routing.
Written by Emil.E
emil.elazar@mail.huji.ac.il
Israel
*/

int SMS_GSMDecode(unsigned char *dest, const unsigned char *source,int length)
{
       int i = 0, j=0, s=0;
       int num_ext_bits = 1;
       unsigned char ext_bits[7]={0,0,0,0,0,0,0};
       unsigned char temp=0;

       for (i = 0; i =8) num_ext_bits=1;
                ext_bits[j] =  source[s] &gt;&gt; (8-num_ext_bits);
                temp =  source[s]&lt;&gt;(num_ext_bits);
                if(j&gt;0)
                    dest[i] = (dest[i] &lt;&lt; j) &#124; ext_bits[j-1];
                               
                num_ext_bits++;
        }

        dest[i] = &#039;&#039;;
        return 1;
}

Best Regards,
Emil</description>
		<content:encoded><![CDATA[<p>Hi,<br />
here is PDU to TXT</p>
<p>/*<br />
GSM-7 packing routing.<br />
Written by Emil.E<br />
<a href="mailto:emil.elazar@mail.huji.ac.il">emil.elazar@mail.huji.ac.il</a><br />
Israel<br />
*/</p>
<p>int SMS_GSMDecode(unsigned char *dest, const unsigned char *source,int length)<br />
{<br />
       int i = 0, j=0, s=0;<br />
       int num_ext_bits = 1;<br />
       unsigned char ext_bits[7]={0,0,0,0,0,0,0};<br />
       unsigned char temp=0;</p>
<p>       for (i = 0; i =8) num_ext_bits=1;<br />
                ext_bits[j] =  source[s] &gt;&gt; (8-num_ext_bits);<br />
                temp =  source[s]&lt;&gt;(num_ext_bits);<br />
                if(j&gt;0)<br />
                    dest[i] = (dest[i] &lt;&lt; j) | ext_bits[j-1];</p>
<p>                num_ext_bits++;<br />
        }</p>
<p>        dest[i] = &#039;&#039;;<br />
        return 1;<br />
}</p>
<p>Best Regards,<br />
Emil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joker</title>
		<link>http://mobiletidings.com/2009/07/06/how-to-pack-gsm7-into-septets/comment-page-1/#comment-1603</link>
		<dc:creator>Joker</dc:creator>
		<pubDate>Fri, 12 Mar 2010 11:39:46 +0000</pubDate>
		<guid isPermaLink="false">http://mobiletidings.com/?p=289#comment-1603</guid>
		<description>Very good this C function for packing with padding.
Do you also have the reverse C function?

&quot;How to UNpack septets characters into GSM-7 charset&quot;?</description>
		<content:encoded><![CDATA[<p>Very good this C function for packing with padding.<br />
Do you also have the reverse C function?</p>
<p>&#8220;How to UNpack septets characters into GSM-7 charset&#8221;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeroen</title>
		<link>http://mobiletidings.com/2009/07/06/how-to-pack-gsm7-into-septets/comment-page-1/#comment-1594</link>
		<dc:creator>Jeroen</dc:creator>
		<pubDate>Tue, 23 Feb 2010 04:51:54 +0000</pubDate>
		<guid isPermaLink="false">http://mobiletidings.com/?p=289#comment-1594</guid>
		<description>If you use SMPP you don&#039;t have to pack the characters, the SMSC will do it for you. Likewise you don&#039;t have to worry about padding bits.
&lt;br&gt;
Cheers,
Jeroen</description>
		<content:encoded><![CDATA[<p>If you use SMPP you don&#8217;t have to pack the characters, the SMSC will do it for you. Likewise you don&#8217;t have to worry about padding bits.<br />
<br />
Cheers,<br />
Jeroen</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://mobiletidings.com/2009/07/06/how-to-pack-gsm7-into-septets/comment-page-1/#comment-1593</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Sun, 21 Feb 2010 05:56:45 +0000</pubDate>
		<guid isPermaLink="false">http://mobiletidings.com/?p=289#comment-1593</guid>
		<description>Jeroen,

My complication is that I am actually trying to pack the text to be sent in an SMPP msg that will then
be sent via GSM to the handset. The length in SMPP is defined in octets.

Is this even valid?  Or should the SMSC (the receiver of the SMPP msg) be the one doing the packing?

Thanks
Tom</description>
		<content:encoded><![CDATA[<p>Jeroen,</p>
<p>My complication is that I am actually trying to pack the text to be sent in an SMPP msg that will then<br />
be sent via GSM to the handset. The length in SMPP is defined in octets.</p>
<p>Is this even valid?  Or should the SMSC (the receiver of the SMPP msg) be the one doing the packing?</p>
<p>Thanks<br />
Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeroen</title>
		<link>http://mobiletidings.com/2009/07/06/how-to-pack-gsm7-into-septets/comment-page-1/#comment-1592</link>
		<dc:creator>Jeroen</dc:creator>
		<pubDate>Sun, 21 Feb 2010 03:11:15 +0000</pubDate>
		<guid isPermaLink="false">http://mobiletidings.com/?p=289#comment-1592</guid>
		<description>Tom,

In my personal experience, all modern devices look at the UDL (User Data Length; which in the case of GSM-7 is expressed in septets) to determine the size of the payload. This avoids any confusion regarding padding bits being interpreted as &#039;@&#039; and &lt;CR&gt; being ignored.

So to be short, as long as you have your UDL correct, this does not need to be handled (I know my code doesn&#039;t handle this).

It is a common bug to first encode the payload and then determine the UDL from the number of octets that the encoded payload occupies. In this case the section you quote may save you.

Jeroen</description>
		<content:encoded><![CDATA[<p>Tom,</p>
<p>In my personal experience, all modern devices look at the UDL (User Data Length; which in the case of GSM-7 is expressed in septets) to determine the size of the payload. This avoids any confusion regarding padding bits being interpreted as &#8216;@&#8217; and &lt;CR&gt; being ignored.</p>
<p>So to be short, as long as you have your UDL correct, this does not need to be handled (I know my code doesn&#8217;t handle this).</p>
<p>It is a common bug to first encode the payload and then determine the UDL from the number of octets that the encoded payload occupies. In this case the section you quote may save you.</p>
<p>Jeroen</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Esh</title>
		<link>http://mobiletidings.com/2009/07/06/how-to-pack-gsm7-into-septets/comment-page-1/#comment-1591</link>
		<dc:creator>Tom Esh</dc:creator>
		<pubDate>Sat, 20 Feb 2010 05:00:58 +0000</pubDate>
		<guid isPermaLink="false">http://mobiletidings.com/?p=289#comment-1591</guid>
		<description>For GSM sms, does this need to be addressed?

http://www.3gpp.org/ftp/Specs/html-info/23038.htm
From 3GPP TS 23.038 V9.1.1 (2010-02)

If the total number of characters to be sent equals
(8n - 1) where n=1,2,3 etc. then there are 7 spare bits at the end of the message. To avoid the situation where the receiving entity confuses 7 binary zero pad bits as the @ character, the carriage return or &lt;CR;&gt; character (defined in clause 6.1.1) shall be used for padding
in this situation, just as for Cell Broadcast.

If &lt;CR&gt; is intended to be the last character and the message (including the wanted ) ends on an octet boundary, then another &lt;CR&gt; must be added together with a padding bit 0. The receiving entity will perform the carriage return function twice, but this will not result in misoperation as the definition
of &lt;CR&gt; in clause 6.1.1 is identical to the definition of &lt;CR&gt;&lt;CR&gt;.  The receiving entity shall remove the final &lt;CR&gt; character where the message ends on an octet boundary with &lt;CR&gt; as the last character.


If not, then how is this case handled in gsm sms?</description>
		<content:encoded><![CDATA[<p>For GSM sms, does this need to be addressed?</p>
<p><a href="http://www.3gpp.org/ftp/Specs/html-info/23038.htm" rel="nofollow">http://www.3gpp.org/ftp/Specs/html-info/23038.htm</a><br />
From 3GPP TS 23.038 V9.1.1 (2010-02)</p>
<p>If the total number of characters to be sent equals<br />
(8n &#8211; 1) where n=1,2,3 etc. then there are 7 spare bits at the end of the message. To avoid the situation where the receiving entity confuses 7 binary zero pad bits as the @ character, the carriage return or &lt;CR;&gt; character (defined in clause 6.1.1) shall be used for padding<br />
in this situation, just as for Cell Broadcast.</p>
<p>If &lt;CR&gt; is intended to be the last character and the message (including the wanted ) ends on an octet boundary, then another &lt;CR&gt; must be added together with a padding bit 0. The receiving entity will perform the carriage return function twice, but this will not result in misoperation as the definition<br />
of &lt;CR&gt; in clause 6.1.1 is identical to the definition of &lt;CR&gt;&lt;CR&gt;.  The receiving entity shall remove the final &lt;CR&gt; character where the message ends on an octet boundary with &lt;CR&gt; as the last character.</p>
<p>If not, then how is this case handled in gsm sms?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

