B2G/gecko/dom/mobilemessage/src/ril/WspPduHelper.jsm
/**
   * @param data
   *        A wrapped object to store encoded raw data.
   * @param token
   *        String text of one character to be encoded.
   *
   * @throws CodeError if an invalid character got.
   */
@param data
A wrapped object to store encoded raw data.
@param token
String text of one character to be encoded.

@throws CodeError if an invalid character got.
@param data A wrapped object to store encoded raw data . @param token String text of one character to be encoded . @throws CodeError if an invalid character got .
function encode(data, token) {
    if (!token) {
      throw new CodeError("Token: empty string");
    }
    let code = token.charCodeAt(0);
    if ((code < ASCIIS) && (code >= CTLS)) {
      if ((code == HT) || (code == SP)
          || (code == 34) || (code == 40) || (code == 41) 
          || (code == 44) || (code == 47)                 
          || ((code >= 58) && (code <= 64))               
          || ((code >= 91) && (code <= 93))               
          || (code == 123) || (code == 125)) {            
      } else {
        Octet.encode(data, token.charCodeAt(0));
        return;
      }
    }
    throw new CodeError("Token: invalid char code " + code);
  }
function encode ( data , token ) { if ( ! token ) { throw new CodeError ( "Token: empty string" ) ; } let code = token . charCodeAt ( 0 ) ; if ( ( code < ASCIIS ) && ( code >= CTLS ) ) { if ( ( code == HT ) || ( code == SP ) || ( code == 34 ) || ( code == 40 ) || ( code == 41 ) || ( code == 44 ) || ( code == 47 ) || ( ( code >= 58 ) && ( code <= 64 ) ) || ( ( code >= 91 ) && ( code <= 93 ) ) || ( code == 123 ) || ( code == 125 ) ) { } else { Octet . encode ( data , token . charCodeAt ( 0 ) ) ; return ; } } throw new CodeError ( "Token: invalid char code " + code ) ; }
@param data
        A wrapped object to store encoded raw data.
@param data A wrapped object to store encoded raw data .
// ASCII "() // ASCII ,/ // ASCII :;<=>?@ // ASCII [\] // ASCII {} // Fallback to throw CodeError