| mime_parse | R Documentation |
mime_parse() is the WHATWG MIME Sniffing Standard's "parse a MIME
type". Type and subtype are lower-cased HTTP tokens. Parameters keep
their order, and their names are lower-cased. Quoted values are
unescaped. A repeated name keeps its first value. mime_format() is
"serialize a MIME type". It quotes a value that is empty or not a token.
mime_parse(x, strict = FALSE)
mime_format(record)
x |
A character vector of MIME types, such as |
strict |
If |
record |
One record from |
mime_format() checks a record before serialising it, so an edited
record cannot carry a line break into a header. Type, subtype and
parameter names must be non-empty HTTP tokens. Values must hold only HTTP
quoted-string token code points: tab, U+0020 to U+007E and U+0080 to
U+00FF. A record that breaks this raises zumime_type_error.
mime_parse() returns a list with one record per input: a list
of type, subtype and parameters (a named list of strings), or
NULL for input that fails to parse and for NA.
mime_format() returns a character vector, NA for a NULL record.
https://mimesniff.spec.whatwg.org/#parsing-a-mime-type
mime_sniff(), which takes a supplied type in this grammar.
rec <- mime_parse("Text/HTML; Charset=\"UTF-8\"; charset=latin1")
str(rec)
mime_format(rec)
mime_format(mime_parse("text/plain;name=\"a b\""))
mime_parse("not a type")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.