pub fn parse_extended_value(val: &str) -> Result<ExtendedValue, ParseError>
Expand description
Parses extended header parameter values (ext-value
), as defined
in RFC 5987 §3.2.
Extended values are denoted by parameter names that end with *
.
§ABNF
ext-value = charset "'" [ language ] "'" value-chars
; like RFC 2231's <extended-initial-value>
; (see [RFC 2231 §7])
charset = "UTF-8" / "ISO-8859-1" / mime-charset
mime-charset = 1*mime-charsetc
mime-charsetc = ALPHA / DIGIT
/ "!" / "#" / "$" / "%" / "&"
/ "+" / "-" / "^" / "_" / "`"
/ "{" / "}" / "~"
; as <mime-charset> in [RFC 2978 §2.3]
; except that the single quote is not included
; SHOULD be registered in the IANA charset registry
language = <Language-Tag, defined in [RFC 5646 §2.1]>
value-chars = *( pct-encoded / attr-char )
pct-encoded = "%" HEXDIG HEXDIG
; see [RFC 3986 §2.1]
attr-char = ALPHA / DIGIT
/ "!" / "#" / "$" / "&" / "+" / "-" / "."
/ "^" / "_" / "`" / "|" / "~"
; token except ( "*" / "'" / "%" )