duesee / imap-codec

Rock-solid and complete codec for IMAP
Apache License 2.0
39 stars 14 forks source link

spec: Verify that `Charset` is correct. #266

Closed duesee closed 1 year ago

duesee commented 1 year ago

According to IMAP, we have ...

search = "SEARCH" [SP "CHARSET" SP astring] 1*(SP search-key)
         ; CHARSET argument to MUST be registered with IANA

So, it seems that we want an AString.

But [CHARSET] tells us that ...

mime-charset       = 1*mime-charset-chars
mime-charset-chars = ALPHA / DIGIT /
                     "!" / "#" / "$" / "%" / "&" /
                     "'" / "+" / "-" / "^" / "_" /
                     "`" / "{" / "}" / "~"
ALPHA              = "A".."Z" ; Case insensitive ASCII Letter
DIGIT              = "0".."9" ; Numeric digit

Currently, we have ...

pub enum Charset<'a> {
    Atom(Atom<'a>),
    Quoted(Quoted<'a>),
}

🤔

duesee commented 1 year ago

Let's keep AString.