Menu

SharpMimeTools - encoding in header fields

fmtp
2007-08-29
2013-04-22
  • fmtp

    fmtp - 2007-08-29

    Hi,

    the From, To and Cc header fields are not supporting encoded words, in the name field of the address, as referred in rfc2047-5.3...

    I changed this in my version: in SharpMimeHeader, in the From, To and Cc properties, i set the GetHeaderField's rfc2047decode argument to true. I'm not sure it's the correct solution but it seems to work :) 

     
    • Angel Marin

      Angel Marin - 2007-08-29

      Well, the point of the SharpMimeHeader class and their properties is to give raw access to header's content. If you need decoded content, you can use SharpMessage.GetHeaderField.

      Keep in mind that From, To and Cc headers are more complex than simple encoded words, they must be first parsed as name-addr items and then only apply rfc 2047 decoding to the display-name part and leave addr-spec alone. So if you apply decoding to the raw header you can screw it up.

      SharpMessage's From, To, Cc properties are the right way to access these headers, as they provide an IEnumerable list of SharpMimeAddress instances that have handled decoding properly.

       
    • fmtp

      fmtp - 2007-08-30

      Sorry, i wasn't seeing the all picture. Thanks for your time.

       
      • Angel Marin

        Angel Marin - 2007-08-30

        I should definitely improve documentation :)

         

Log in to post a comment.