Crate quoted_string [−] [src]
This crate provides utilities to handle quoted strings as they appear in multiple mail and web related RFCs. While it is mainly based on RFC5322 (Internet Message Format). It also supports Utf8 based on RFC6532 (optional) and is compatible with quoted-strings as they appear in mime types (including in HTTP/1.1 context).
What it currently does not support are soft-line breaks of RFC5322 and the obsolete parts of the syntax.
Grammar
quoted-string = DQUOTE *( *WSP qcontent) *WSP DQUOTE
WSP = ' ' / '\t'
qcontent = qtext / quoted-pair
qtext = %d33 / %d35-91 / %d93-126 ; printable us-ascii chars not including '\\' and '"'
quoted-pair = ("\" (VCHAR / WSP)) ; VCHAR are printable us-ascii chars
The obsolete syntax is currently not supported. Differences would be:
- it would allow CTL's in qtext
- it would allow quoted pairs to escape CTL's,
'\0'
,'\n'
,'\r'
Nevertheless this part of the syntax is obsolete and should not be generated at all. Adding opt-in support for parts parsing quoted-string is in consideration.
Modules
error |
quoted-string errors |
Structs
ContentChars |
A iterator over chars of the content represented by the quoted strings (PartialEq<&str>) |
Enums
CharType |
A enum for usage in combination with the QTEXT_INFO lookup table |
QuotedStringType |
Indicates what kind of quoted-strings are used |
Traits
AsciiCaseInsensitiveEq |
Analogous to PartialEq, but with ascii case insensitive equality |
ValidWithoutQuotationCheck |
Used to determine 1. if the string needs quoting 2. where the first char which could require quoting appears |
Functions
quote |
quotes the input string returning the quoted string and if it contains non us-ascii chars. |
quote_if_needed |
quotes the input string if needed(RFC 5322/6532/822/2045) |
unquote_unchecked |
undoes quoting of given input assuming it is a valid quoted-string |