Core/Data/WebHelpers/escape.h File Reference
Include dependency graph for Core/Data/WebHelpers/escape.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
unsigned | uri_escape_len (const char *s, size_t len) |
Obtain number of characters required to escape the given text. More... | |
static unsigned | uri_escape_len (const String &str) |
char * | uri_escape (char *dest, size_t dest_len, const char *src, int src_len) |
Escape text. More... | |
char * | uri_unescape (char *dest, size_t dest_len, const char *src, int src_len) |
unescape text More... | |
unsigned | html_escape_len (const char *s, size_t len) |
void | html_escape (char *dest, size_t len, const char *s) |
char * | uri_unescape_inplace (char *str) |
Replace a nul-terminated string with its unescaped version. More... | |
String | uri_escape (const char *src, int src_len) |
escape the given URI string More... | |
static String | uri_escape (const String &src) |
String & | uri_unescape_inplace (String &str) |
replace the given text by its unescaped version More... | |
static String | uri_unescape (const String &str) |
return the unescaped version of a string More... | |
Function Documentation
◆ html_escape()
void html_escape | ( | char * | dest, |
size_t | len, | ||
const char * | s | ||
) |
◆ html_escape_len()
unsigned html_escape_len | ( | const char * | s, |
size_t | len | ||
) |
◆ uri_escape() [1/3]
char* uri_escape | ( | char * | dest, |
size_t | dest_len, | ||
const char * | src, | ||
int | src_len | ||
) |
Escape text.
- Parameters
-
dest buffer to store result dest_len available space in dest; requires +1 extra character for nul terminator, so at least uri_escape_len() + 1 src source text to escape src_len number of characters in source
- Return values
-
char* points to start of dest
- Note
- destination and source MUST be different buffers
◆ uri_escape() [2/3]
escape the given URI string
- Parameters
-
src src_len
- Return values
-
String the escaped string
- Note
- escaping may increase text size (but not always)
◆ uri_escape() [3/3]
◆ uri_escape_len() [1/2]
unsigned uri_escape_len | ( | const char * | s, |
size_t | len | ||
) |
Obtain number of characters required to escape the given text.
- Parameters
-
s source text len Number of characters in source text
- Return values
-
unsigned number of characters for output, NOT including nul terminator
◆ uri_escape_len() [2/2]
|
inlinestatic |
◆ uri_unescape() [1/2]
char* uri_unescape | ( | char * | dest, |
size_t | dest_len, | ||
const char * | src, | ||
int | src_len | ||
) |
unescape text
- Parameters
-
dest buffer to store result dest_len available space in dest; requires +1 extra character for nul terminator src source text to un-escape src_len number of characters in source
- Return values
-
char* points to start of dest
- Note
- destination and source may be the same buffer
◆ uri_unescape() [2/2]
return the unescaped version of a string
- Return values
-
String unescaped string
◆ uri_unescape_inplace() [1/2]
char* uri_unescape_inplace | ( | char * | str | ) |
Replace a nul-terminated string with its unescaped version.
- Parameters
-
str the string to un-escape
- Return values
-
char* the result, a copy of str
- Note
- unescaped string is never longer than escaped version