Skip to content

Commit

Permalink
IDN encode/decode the local part of mailbox addresses as well
Browse files Browse the repository at this point in the history
  • Loading branch information
jstedfast committed Feb 23, 2018
1 parent e1d0d31 commit d581a11
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions MimeKit/MailboxAddress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ static string EncodeAddrspec (string addrspec, int at)
var domain = addrspec.Substring (at + 1);
var local = addrspec.Substring (0, at);

if (ParseUtils.IsInternational (local))
local = ParseUtils.IdnEncode (local);

if (ParseUtils.IsInternational (domain))
domain = ParseUtils.IdnEncode (domain);

Expand Down Expand Up @@ -361,6 +364,9 @@ static string DecodeAddrspec (string addrspec, int at)
var domain = addrspec.Substring (at + 1);
var local = addrspec.Substring (0, at);

if (ParseUtils.IsIdnEncoded (local))
local = ParseUtils.IdnDecode (local);

if (ParseUtils.IsIdnEncoded (domain))
domain = ParseUtils.IdnDecode (domain);

Expand Down

0 comments on commit d581a11

Please sign in to comment.