libsms_charset.c

Go to the documentation of this file.
00001 /*
00002 SMS Server Tools
00003 Copyright (C) 2000 Stefan Frings
00004 
00005 This program is free software unless you got it under another license directly
00006 from the author. You can redistribute it and/or modify it under the terms of 
00007 the GNU General Public License as published by the Free Software Foundation.
00008 Either version 2 of the License, or (at your option) any later version.
00009 
00010 http://www.isis.de/members/~s.frings
00011 mailto:s.frings@mail.isis.de
00012  */
00013 
00014 
00015 #include "libsms_charset.h"
00016 
00017 #define noc 183 
00018 // non existent character
00019 
00020 // iso 8859-1
00021 unsigned char charset[128] ={
00022            '@' , 163 , '$' , 165 , 232 , 233 , 249 , 236 ,
00023            242 , 199 ,  10 , 216 , 248 ,  13 , 197 , 229 ,
00024            noc , '_' , noc , noc , noc , noc , noc , noc ,
00025            noc , noc , noc , noc , 198 , 230 , 223 , 201 ,
00026            ' ' , '!' ,  34 , '#' , '$' , '%' , '&' ,  39 ,
00027            '(' , ')' , '*' , '+' , ',' , '-' , '.' , '/' ,
00028            '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' ,
00029            '8' , '9' , ':' , ';' , '<' , '=' , '>' , '?' ,
00030            161 , 'A' , 'B' , 'C' , 'D' , 'E' , 'F' , 'G' ,
00031            'H' , 'I' , 'J' , 'K' , 'L' , 'M' , 'N' , 'O' ,
00032            'P' , 'Q' , 'R' , 'S' , 'T' , 'U' , 'V' , 'W' ,
00033            'X' , 'Y' , 'Z' , 196 , 214 , 209 , 220 , 167 ,
00034            191 , 'a' , 'b' , 'c' , 'd' , 'e' , 'f' , 'g' ,
00035            'h' , 'i' , 'j' , 'k' , 'l' , 'm' , 'n' , 'o' ,
00036            'p' , 'q' , 'r' , 's' , 't' , 'u' , 'v' , 'w' ,
00037            'x' , 'y' , 'z' , 228 , 246 , 241 , 252 , 224 };
00038             
00039 char ascii2sms(const char c)
00040 {
00041    char found='*'; // replacement for nonexistent characters
00042    int i;
00043 
00044    for (i=0; i<128 ; i++)
00045       if (c==charset[i])
00046       {
00047          found=i;
00048          break;
00049       }
00050 
00051    return found;
00052 }
00053 
00054 
00055 
00056 
00057 char sms2ascii(const char c)
00058 {
00059    return charset[(int)c];
00060 }

Generated on Wed May 23 18:00:28 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6