[Prev] [Next] [Top] [Bottom] [Contents] (73 out of 193)

SaMakeHtmlString

Makes an HTML-compatible string from its argument.

Synopsis

#include "SaRnHtml.h"

char* SaMakeHtmlString(char* str);

Arguments

str
The string to convert.

Return Values

Returns an HTML-compatible string from its argument. Returns an empty string if the input is NULL.

Description

Returns an HTML-compatible string from its argument. Returns an empty string if the input is NULL. When you send back HTML from a cgi, you must escape certain characters so that the browser does not interpret them as special HTML characters. The browser will then "unescape" the string and the original characters will appear to the user. The following translations are done:

< becomes "&lt;"
> becomes "&gt;"
& becomes "&amp;"
" becomes "&quot;"
The returned string is malloc'd data and must be free'd. Use this function when writing out data to return from a cgi.

Example

char* htmlStr;
htmlStr = SaMakeHtmlString("<>");
/*** htmlStr contains: &lt;&gt; ****/
free(htmlStr);

See Also


[Prev] [Next] [Top] [Bottom] [Contents] (73 out of 193)