Skip to main content

encode_unquoted_attribute_to_vec

Function encode_unquoted_attribute_to_vec 

Source
pub fn encode_unquoted_attribute_to_vec<S: AsRef<str>>(
    text: S,
    output: &mut Vec<u8>,
) -> &[u8] ⓘ
Expand description

Write text used in an unquoted attribute to a mutable Vec<u8> reference and return the encoded data slice. Except for alphanumeric characters, escape all characters which are less than 128.

This appends to output and returns only the new data slice. Use a quoted attribute for an empty value; this function does not add quotes.

The following characters are escaped to named entities:

  • & => &amp;
  • < => &lt;
  • > => &gt;
  • " => &quot;

Other non-alphanumeric characters are escaped to &#xHH;.