Difference between revisions of "Htmlent"

From Mailutils
Jump to navigationJump to search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''Htmlent''' is a filter that converts characters '''<''', '''>''', and '''&''' to their corresponding [http://en.wikipedia.org/wiki/Character_entity_reference HTML entites] and vice-versa.
+
The <tt>htmlent</tt> filter converts characters '''<''', '''>''', and '''&''' to their corresponding [http://en.wikipedia.org/wiki/Character_entity_reference HTML entites] and vice-versa.
  
 
In ''encode'' mode, the filter replaces each occurrence of these characters with the corresponding named entity.  In ''decode'' mode the reverse operation is performed.
 
In ''encode'' mode, the filter replaces each occurrence of these characters with the corresponding named entity.  In ''decode'' mode the reverse operation is performed.
Line 7: Line 7:
 
The following object, declared in '''mailutils/filter.h''' describes the ''htmlent'' filter:
 
The following object, declared in '''mailutils/filter.h''' describes the ''htmlent'' filter:
  
<source lang="C">
+
<syntaxhighlight lang="C">
 
extern mu_filter_record_t mu_htmlent_filter;
 
extern mu_filter_record_t mu_htmlent_filter;
</source>
+
</syntaxhighlight>
  
 
The example below shows how to create an instance of this filter in decode mode for reading:
 
The example below shows how to create an instance of this filter in decode mode for reading:
  
<source lang="C">
+
<syntaxhighlight lang="C">
 
   int rc;          /* Return code */
 
   int rc;          /* Return code */
 
   mu_stream_t flt; /* Filter stream */
 
   mu_stream_t flt; /* Filter stream */
 
   mu_stream_t input; /* Input stream */
 
   mu_stream_t input; /* Input stream */
 
   
 
   
   initialize_input_stream (&stream);
+
   initialize_input_stream (&input);
   rc = mu_filter_stream_create (&flt, input, "htmlent", MU_FILTER_DECODE, MU_STREAM_READ);
+
   rc = mu_filter_create (&flt, input, "htmlent", MU_FILTER_DECODE, MU_STREAM_READ);
</source>
+
</syntaxhighlight>
 +
 
 +
 
 +
== See also ==
 +
 
 +
* [[xml (filter)|xml]] filter
  
 
[[Category:Filters]]
 
[[Category:Filters]]
 
[[Category:C API]]
 
[[Category:C API]]

Latest revision as of 13:23, 16 October 2023

The htmlent filter converts characters <, >, and & to their corresponding HTML entites and vice-versa.

In encode mode, the filter replaces each occurrence of these characters with the corresponding named entity. In decode mode the reverse operation is performed.

The filter does not take arguments.

The following object, declared in mailutils/filter.h describes the htmlent filter:

extern mu_filter_record_t mu_htmlent_filter;

The example below shows how to create an instance of this filter in decode mode for reading:

  int rc;          /* Return code */
  mu_stream_t flt; /* Filter stream */
  mu_stream_t input; /* Input stream */
 
  initialize_input_stream (&input);
  rc = mu_filter_create (&flt, input, "htmlent", MU_FILTER_DECODE, MU_STREAM_READ);


See also