| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

http_unescape_hex

#include "sflhttp.h"
char *
http_unescape_hex (
    char *string,
    char *result)

Synopsis

Removes HTTP hex escaping from a URL string, by expanding any sequences of characters %xx.

Source Code - (sflhttp.c)

{
    char
        *target;                        /*  Where we store the result        */

    ASSERT (string);
    if (!result)                        /*  If result string is null,        */
        result = string;                /*    modify in place                */
    target = result;

    while (*string)
      {
        if (*string == '%'              /*  Unescape %xx sequence            */
        &&   string [1] && string [2])
          {
            string++;
            *target = decode_hex ((const char **) &string, 2);
            target++;
          }
        else
          {
            *target++ = *string;        /*  Otherwise just copy              */
            string++;
          }
      }
    *target = '\0';                     /*  Terminate target string          */
    return (result);
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation