##// END OF EJS Templates
mail: move strtolocal call in _addressencode()
Denis Laxalde -
r44027:ddb5d097 default
parent child Browse files
Show More
@@ -395,8 +395,8 b' def headencode(ui, s, charsets=None, dis'
395 395
396 396
397 397 def _addressencode(ui, name, addr, charsets=None):
398 # type: (Any, str, bytes, List[str]) -> str
399 assert isinstance(addr, bytes)
398 # type: (Any, str, str, List[str]) -> str
399 addr = encoding.strtolocal(addr)
400 400 name = headencode(ui, name, charsets)
401 401 try:
402 402 acc, dom = addr.split(b'@')
@@ -420,7 +420,7 b' def addressencode(ui, address, charsets='
420 420 if display or not address:
421 421 return encoding.strfromlocal(address or b'')
422 422 name, addr = email.utils.parseaddr(encoding.strfromlocal(address))
423 return _addressencode(ui, name, encoding.strtolocal(addr), charsets)
423 return _addressencode(ui, name, addr, charsets)
424 424
425 425
426 426 def addrlistencode(ui, addrs, charsets=None, display=False):
@@ -438,7 +438,7 b' def addrlistencode(ui, addrs, charsets=N'
438 438 result = []
439 439 for name, addr in email.utils.getaddresses(straddrs):
440 440 if name or addr:
441 r = _addressencode(ui, name, encoding.strtolocal(addr), charsets)
441 r = _addressencode(ui, name, addr, charsets)
442 442 result.append(r)
443 443 return result
444 444
General Comments 0
You need to be logged in to leave comments. Login now