js/sms_message_analyser.js
/**
 * Verifies that "GSM default" charset can represent (:true) every character in the input message or not (:false).
 * The function is being initialized with the "message" input by the user.
 * The function returns a "boolean" value as described above. Note: it returns "true" if and only if "GSM default" charset
 * can represent any message character, else it returns "false" if at least one message character cannot be represented 
 * by this charset.
 */
Verifies that "GSM default" charset can represent (:true) every character in the input message or not (:false).
The function is being initialized with the "message" input by the user.
The function returns a "boolean" value as described above.
Verifies that " GSM default " charset can represent ( : true ) every character in the input message or not ( : false ) . The function is being initialized with the " message " input by the user . The function returns a " boolean " value as described above .
function is_GSM_default(msg) {
  if (msg === null) {
    return true;
  }
  var len = msg.length;
  for (i = 0; i < len; i++) {
    var c = msg.charAt(i);
    if ((c >= ' ' && c <= '_') || (c >= 'a' && c <= '~')) {
      continue;
    } 
	else {      
      switch (c) {
        case '\u00A3':
        case '\u00A5':
        case '\u00E8':
        case '\u00E9':
        case '\u00F9':
        case '\u00EC':
        case '\u00F2':
        case '\u00C7':
        case '\n':
        case '\u00D8':
        case '\u00F8':
        case '\r':
        case '\u000c':
        case '\u00C5':
        case '\u00E5':
        case '\u0394':
        case '\u03A6':
        case '\u0393':
        case '\u039B':
        case '\u03A9':
        case '\u03A0':
        case '\u03A8':
        case '\u03A3':
        case '\u0398':
        case '\u039E':
        case '\u00C6':
        case '\u00E6':
        case '\u00DF':
        case '\u00C9':
        case '\u00A4':
        case '\u00A1':
        case '\u00C4':
        case '\u00D6':
        case '\u00D1':
        case '\u00DC':
        case '\u00A7':
        case '\u00BF':
        case '\u00E4':
        case '\u00F6':
        case '\u00F1':
        case '\u00FC':
        case '\u00E0':
        case '\u20AC':
          continue;
        default:
          return false;
      }
    }
  }
  return true;
}
function is_GSM_default ( msg ) { if ( msg === null ) { return true ; } var len = msg . length ; for ( i = 0 ; i < len ; i ++ ) { var c = msg . charAt ( i ) ; if ( ( c >= ' ' && c <= '_' ) || ( c >= 'a' && c <= '~' ) ) { continue ; } else { switch ( c ) { case '\u00A3' : case '\u00A5' : case '\u00E8' : case '\u00E9' : case '\u00F9' : case '\u00EC' : case '\u00F2' : case '\u00C7' : case '\n' : case '\u00D8' : case '\u00F8' : case '\r' : case '\u000c' : case '\u00C5' : case '\u00E5' : case '\u0394' : case '\u03A6' : case '\u0393' : case '\u039B' : case '\u03A9' : case '\u03A0' : case '\u03A8' : case '\u03A3' : case '\u0398' : case '\u039E' : case '\u00C6' : case '\u00E6' : case '\u00DF' : case '\u00C9' : case '\u00A4' : case '\u00A1' : case '\u00C4' : case '\u00D6' : case '\u00D1' : case '\u00DC' : case '\u00A7' : case '\u00BF' : case '\u00E4' : case '\u00F6' : case '\u00F1' : case '\u00FC' : case '\u00E0' : case '\u20AC' : continue ; default : return false ; } } } return true ; }
Verifies that "GSM default" charset can represent (:true) every character in the input message or not (:false).
Verifies that " GSM default " charset can represent ( : true ) every character in the input message or not ( : false ) .
/** Input message null; exit immediately. */ /** Store message length. */ /** 
   * Loop through all message characters confirming that each one of those can be represented
   * by the "GSM default" charset.
   */ /** Get the char at the current index in this string. */ /** Simple range checks for most common characters (0x20 -> 0x5F) or (0x61 -> 0x7E). */ /** More efficient using a "switch" statement than a lookup table search. */ // £ // ¥ // è // é // ù // ì // ò // Ç // newline // Ø // ø // carriage return // form feed // Å // å // Δ // Φ // Γ // Λ // Ω // Π // Ψ // Σ // Θ // Ξ // Æ // æ // ß // É // ¤ // ¡ // Ä // Ö // Ñ // Ü // § // ¿ // ä // ö // ñ // ü // à // € /** 
		   * The current message character is not part of the "GSM default" charset; 
		   * at least one "invalid" character found - exit immediately with status: "fail". 
		   */ /** All message characters are part of the "GSM default" charset; exit with status: "success". */