src/universal-analytics.c
static int encodeURIComponent(char input[], char output[], const unsigned int input_len, const UABoolean_t add_null){
  assert(NULL != output); // avoid null-dereference
  assert(NULL != input); // avoid null-dereference
  int i, j = 0;
  for(i = 0; i < input_len; i++){
    if(isalnum((unsigned char) input[i]) || input[i] == '-' || input[i] == '.' || input[i] == '~'){
      output[j++] = input[i];
    } else if(input[i] == ' '){
      output[j++] = '+';
    } else {
      output[j++] = '%';
      output[j++] = _hexchar[ (int) (input[i] >> 4) & 15];
      output[j++] = _hexchar[ (int) (input[i] & 15) & 15];
    }
  }

  /* Null termination is optional, to permit sequential calls 
   * of this method against multiple parameters into a single
   * output string */
  if(add_null == UA_TRUE) 
    output[j++] = '\0';
 
  /* Because {j} is incremented as a position index through this process,
   * it represents the length of the string at the end. It will be the last
   * encoded character position +1. */
  return j;
}
/* Copies the input string to output with proper encoding.
 * Allows for populating substrings (i.e. ranges of memory) in existing string buffers.
 */
Copies the input string to output with proper encoding.
Allows for populating substrings  in existing string buffers.
Copies the input string to output with proper encoding . Allows for populating substrings in existing string buffers .
static int encodeURIComponent(char input[], char output[], const unsigned int input_len, const UABoolean_t add_null){
  assert(NULL != output); 
  assert(NULL != input); 
  int i, j = 0;
  for(i = 0; i < input_len; i++){
    if(isalnum((unsigned char) input[i]) || input[i] == '-' || input[i] == '.' || input[i] == '~'){
      output[j++] = input[i];
    } else if(input[i] == ' '){
      output[j++] = '+';
    } else {
      output[j++] = '%';
      output[j++] = _hexchar[ (int) (input[i] >> 4) & 15];
      output[j++] = _hexchar[ (int) (input[i] & 15) & 15];
    }
  }
  if(add_null == UA_TRUE) 
    output[j++] = '\0';
  return j;
}
static int encodeURIComponent ( char input [ ] , char output [ ] , const unsigned int input_len , const UABoolean_t add_null ) { assert ( NULL != output ) ; assert ( NULL != input ) ; int i , j = 0 ; for ( i = 0 ; i < input_len ; i ++ ) { if ( isalnum ( ( unsigned char ) input [ i ] ) || input [ i ] == ' ' || input [ i ] == ' ' || input [ i ] == ' ' ) { output [ j ++ ] = input [ i ] ; } else if ( input [ i ] == ' ' ) { output [ j ++ ] = ' ' ; } else { output [ j ++ ] = ' ' ; output [ j ++ ] = _hexchar [ ( int ) ( input [ i ] >> 4 ) & 15 ] ; output [ j ++ ] = _hexchar [ ( int ) ( input [ i ] & 15 ) & 15 ] ; } } if ( add_null == UA_TRUE ) output [ j ++ ] = ' \0 ' ; return j ; }
Copies the input string to output with proper encoding.
Copies the input string to output with proper encoding .
// avoid null-dereference // avoid null-dereference /* Null termination is optional, to permit sequential calls 
   * of this method against multiple parameters into a single
   * output string */ /* Because {j} is incremented as a position index through this process,
   * it represents the length of the string at the end. It will be the last
   * encoded character position +1. */