Skip to content
  • Rob Swindell's avatar
    Improved parsing of "charset" parameter in MIME Content-Type header. · ad79c591
    Rob Swindell authored
    In Issue #177, the reported problem message header was "Content-Type: text/plain; charset=utf-8; format=flowed"
    The fact that the "charset" value was not quoted and not space delimited means the charset would have been parsed as "utf-8;", which would not provide an exact match (against "utf-8") in smb_msg_is_utf8() and thus the message body would not be considered to be utf-8 encoded.
    
    The solution is to terminate the "charset" parameter value at the semicolon, if it exists, and the value was not quoted.
    
    Also, for good measure, only search for " charset" or ";charset" to avoid false-positive parameter matches,  like "notcharset".
    ad79c591