コード例 #1
0
ファイル: 07-codecs.c プロジェクト: Andrepuel/onion
void t07_codecs_html(){
	INIT_LOCAL();
	
	char *encoded=onion_html_quote("<\"Hello\">");
	FAIL_IF_NOT_EQUAL_STR( encoded, "&lt;&quot;Hello&quot;&gt;");
	free(encoded);
	
	END_LOCAL();
}
コード例 #2
0
ファイル: response.c プロジェクト: davidmoreno/onion
/**
 * @short Writes the given string to the res, but encodes the data using html entities
 * @ingroup response
 *
 * The encoding mens that <code><html> whould become &lt;html&gt;</code>
 */
ssize_t onion_response_write_html_safe(onion_response * res, const char *data) {
  char *tmp = onion_html_quote(data);
  if (tmp) {
    int r = onion_response_write0(res, tmp);
    onion_low_free(tmp);
    return r;
  } else
    return onion_response_write0(res, data);
}