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