<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Embedded Freaks.. &#187; gsm</title>
	<atom:link href="http://embeddedfreak.wordpress.com/tag/gsm/feed/" rel="self" type="application/rss+xml" />
	<link>http://embeddedfreak.wordpress.com</link>
	<description>Daily embedded life tips and trick</description>
	<lastBuildDate>Sat, 14 Nov 2009 00:47:09 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='embeddedfreak.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/9f1113cc5558fcab720e54b7e5a379eb?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Embedded Freaks.. &#187; gsm</title>
		<link>http://embeddedfreak.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://embeddedfreak.wordpress.com/osd.xml" title="Embedded Freaks.." />
		<item>
		<title>GSM 03.40 rev 7.5.0 Document (in PDF)</title>
		<link>http://embeddedfreak.wordpress.com/2008/10/10/gsm-0340-rev-750-document-in-pdf/</link>
		<comments>http://embeddedfreak.wordpress.com/2008/10/10/gsm-0340-rev-750-document-in-pdf/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 02:59:18 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gsm]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=203</guid>
		<description><![CDATA[The original document can be found here, but since GPP team is using Microsoft Word&#8217;s specific document, I have to convert it into PDF file since my linux&#8217;s OpenOffice won&#8217;t display it correctly.
The link to the PDF file can be found here.
Thanks to doc2pdf.net who provides MS Word to PDF converter for free, and my [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=203&subd=embeddedfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The original document can be found <a href="http://www.3gpp.org/ftp/Specs/archive/03_series/03.40/0340-750.zip">here</a>, but since GPP team is using Microsoft Word&#8217;s specific document, I have to convert it into PDF file since my linux&#8217;s OpenOffice won&#8217;t display it correctly.</p>
<p>The link to the PDF file can be found <a href="http://www.4shared.com/file/66354660/67840f75/GSM_SMS_0340_rev_750.html">here</a>.</p>
<p>Thanks to <a href="http://www.doc2pdf.net/converter/">doc2pdf.net</a> who provides MS Word to PDF converter for free, and my company who provides MS Windows and MS Word in my workstation.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/203/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=203&subd=embeddedfreak&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2008/10/10/gsm-0340-rev-750-document-in-pdf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>
	</item>
		<item>
		<title>Java GSM 03.38 SMS Character Set Translator</title>
		<link>http://embeddedfreak.wordpress.com/2008/10/08/java-gsm-0338-sms-character-set-translator/</link>
		<comments>http://embeddedfreak.wordpress.com/2008/10/08/java-gsm-0338-sms-character-set-translator/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 06:17:35 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[gsm]]></category>
		<category><![CDATA[java-sms]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=188</guid>
		<description><![CDATA[This simple class will translate ASCII ISO-8859-1 / Latin-1 character set into GSM 03.38 character set.
I build this class to add support for european characters in my SMS project (using ATMega128). Since the board haven&#8217;t come yet, I built it using Java first and will port it into C later (saves me a lot of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=188&subd=embeddedfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This simple class will translate ASCII ISO-8859-1 / Latin-1 character set into GSM 03.38 character set.</p>
<p>I build this class to add support for european characters in my SMS project (using ATMega128). Since the board haven&#8217;t come yet, I built it using Java first and will port it into C later (saves me a lot of time to build ArrayList-like class in C).</p>
<p><span id="more-188"></span></p>
<pre class="brush: java;">

/*
 * Copyright (c) 2008, Daniel Widyanto &lt;kunilkuda at gmail.com&gt;
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the &lt;organization&gt; nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY Daniel Widyanto ''AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL Daniel Widyanto BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
//package com.kunilkuda; //&lt; Replace with your package

import java.util.ArrayList;

/**
 * \brief Provides services to translate ASCII (ISO-8859-1 / Latin 1) charset
 *        into GSM 03.38 character set
 */
public class GsmCharset {
  /**
   * \brief Escape byte for the extended ISO
   */
  private final Short ESC_BYTE = new Short((short) 27);

  /**
   * \brief ISO-8859-1 - GSM 03.38 character map
   *
   * Taken from http://www.dreamfabric.com/sms/default_alphabet.html
   */
  private final short[] isoGsmMap = {
    // Index = GSM, { ISO }
      64, 163,  36, 165, 232, 233, 249, 236, 242, 199,  10, 216,
     248,  13, 197, 229,   0,  95,   0,   0,   0,   0,   0,   0,
       0,   0,   0,   0, 198, 230, 223, 201,  32,  33,  34,  35,
     164,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
      48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
      60,  61,  62,  63, 161,  65,  66,  67,  68,  69,  70,  71,
      72,  73,  74,  75,  76,  77,  78,  79,  80,  81,  82,  83,
      84,  85,  86,  87,  88,  89,  90, 196, 214, 209, 220, 167,
     191,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107,
     108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
     120, 121, 122, 228, 246, 241, 252, 224
  };

  /**
   * \brief Extended ISO-8859-1 - GSM 03.38 character map
   *
   * Taken from http://www.dreamfabric.com/sms/default_alphabet.html
   */
  private final short[][] extIsoGsmMap = {
    //{ {Ext GSM,ISO} }
    { 10, 12}, { 20, 94}, { 40,123}, { 41,125}, { 47, 92},
    { 60, 91}, { 61,126}, { 62, 93}, { 64,124}, {101,164}
  };

  /**
   * \brief Translate ISO-8859-1 character set into GSM 03.38 character set
   * \param dataIso Data in ISO-8859-1 charset
   * \return GSM03.38 character set in byte array
   */
  public byte[] translateToGsm0338(String dataIso) {
    byte[] dataIsoBytes = dataIso.getBytes();
    ArrayList dataGsm = new ArrayList();

    for (int dataIndex = 0; dataIndex &lt; dataIsoBytes.length; dataIndex++) {
      byte currentDataIso = dataIsoBytes[dataIndex];

      // Search currentDataGsm in the isoGsmMap
      short currentDataGsm = findGsmChar(currentDataIso);

      // If the data is not available in the isoGsmMap, search in the extended
      // ISO-GSM map (extIsoGsmMap)
      if (currentDataGsm == -1) {
        currentDataGsm = findExtGsmChar(currentDataIso);

        // If the character is found inside the extended map, add escape byte in
        // the return byte[]
        if (currentDataGsm != -1) {
          dataGsm.add(ESC_BYTE);
        }
      }

      dataGsm.add(new Short(currentDataGsm));
    }

    Short[] dataGsmShortArray = (Short[]) dataGsm.toArray(new Short[0]);
    return translateShortToByteArray(dataGsmShortArray);
  }

  /**
   * \brief Translate GSM 03.38 character set set into ISO-8859-1 character
   * \param dataGsm Data in GSM 03.38 charset
   * \return ISO-8859-1 string
   */
  public String translateToIso(byte[] dataGsm) {
    ArrayList dataIso = new ArrayList();

    boolean isEscape = false;
    for (int dataIndex = 0; dataIndex &lt; dataGsm.length; dataIndex++) {
      // Convert to short to avoid negative values
      short currentDataGsm = (short) dataGsm[dataIndex];
      short currentDataIso = -1;

      if (currentDataGsm == ESC_BYTE.shortValue()) {
        isEscape = true;
      }
      else if (!isEscape) {
        currentDataIso = findIsoChar(currentDataGsm);
        dataIso.add(new Short(currentDataIso));
      }
      else {
        currentDataIso = findExtIsoChar(currentDataGsm);
        dataIso.add(new Short(currentDataIso));
        isEscape = false;
      }
    }

    Short[] dataIsoShortArray = (Short[]) dataIso.toArray(new Short[0]);
    byte[] dataIsoByteArray = translateShortToByteArray(dataIsoShortArray);
    return new String(dataIsoByteArray);
  }

  /**
   * \brief Find GSM 03.38 character for the ISO-8859-1 character
   * \param isoChar ISO-8859-1 character
   * \result GSM 03.38 character or -1 if no match
   */
  private short findGsmChar(byte isoChar) {
    short gsmChar = -1;

    for (short mapIndex = 0; mapIndex &lt; isoGsmMap.length; mapIndex++) {
      if (isoGsmMap[mapIndex] == (short) isoChar) {
        gsmChar = mapIndex;
        break;
      }
    }

    return gsmChar;
  }

  /**
   * \brief Find extended GSM 03.38 character for the ISO-8859-1 character
   * \param isoChar ISO-8859-1 character
   * \result Extended GSM 03.38 character or 0xFFFF (-1) if no match
   */
  private short findExtGsmChar(byte isoChar) {
    short gsmChar = -1;

    for (short mapIndex = 0; mapIndex &lt; extIsoGsmMap.length; mapIndex++) {
      if (extIsoGsmMap[mapIndex][1] == isoChar) {
        gsmChar = extIsoGsmMap[mapIndex][0];
        break;
      }
    }

    return gsmChar;
  }

  /**
   * \brief Find ISO-8859-1 character for the GSM 03.38 character
   * \param gsmChar GSM 03.38 character
   * \result ISO-8859-1 character or -1 if no match
   */
  private short findIsoChar(short gsmChar) {
    short isoChar = -1;

    if (gsmChar &lt; isoGsmMap.length) {
      isoChar = isoGsmMap[gsmChar];
    }

    return isoChar;
  }

  /**
   * \brief Find ISO-8859-1 character for the extended GSM 03.38 character
   * \param gsmChar Extended GSM 03.38 character
   * \result ISO-8859-1 character or 0xFFFF (-1) if no match
   */
  private short findExtIsoChar(short gsmChar) {
    short isoChar = -1;

    for (short mapIndex = 0; mapIndex &lt; extIsoGsmMap.length; mapIndex++) {
      if (extIsoGsmMap[mapIndex][0] == gsmChar) {
        isoChar = extIsoGsmMap[mapIndex][1];
        break;
      }
    }

    return isoChar;
  }

  /**
   * \brief Translate Short[] array to byte[]. Needed since there's no direct
   *        Java method/class to do this.
   * \param shortArray Short[] array
   * \return byte[] array
   */
  private byte[] translateShortToByteArray(Short[] shortArray) {
    byte[] byteArrayResult = new byte[shortArray.length];

    for (int i = 0; i &lt; shortArray.length; i++) {
      byteArrayResult[i] = (byte) shortArray[i].shortValue();
    }

    return byteArrayResult;
  }

  /**
   * This main function is used for the class test purpose
   */
  public static void main(String[] args) {
    if (args.length &lt; 1) {
      System.out.println(&quot;Usage: java com.kunilkuda.GsmCharset &lt;string&gt;&quot;);
      System.exit(1);
    }

    byte[] data = new GsmCharset().translateToGsm0338(args[0]);
    for(int i = 0; i &lt; data.length; i++) {
      System.out.print(data[i] + &quot; &quot;);
    }
    System.out.println();

    System.out.println(new GsmCharset().translateToIso(data));
  }
}
</pre>
<p>Note that I haven&#8217;t check the character map (ISO-8859-1) completely. So, please let me know if my character map is wrong.</p>
<p>Btw, if you&#8217;re looking on how to use this class, the main method will explain it all.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/188/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&blog=1740165&post=188&subd=embeddedfreak&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2008/10/08/java-gsm-0338-sms-character-set-translator/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>
	</item>
	</channel>
</rss>