##// END OF EJS Templates
mail: let headencode() return a native string...
Denis Laxalde -
r43975:67b4439c default
parent child Browse files
Show More
@@ -421,8 +421,8 b' class notifier(object):'
421 maxsubject = int(self.ui.config(b'notify', b'maxsubject'))
421 maxsubject = int(self.ui.config(b'notify', b'maxsubject'))
422 if maxsubject:
422 if maxsubject:
423 subject = stringutil.ellipsis(subject, maxsubject)
423 subject = stringutil.ellipsis(subject, maxsubject)
424 msg['Subject'] = encoding.strfromlocal(
424 msg['Subject'] = mail.headencode(
425 mail.headencode(self.ui, subject, self.charsets, self.test)
425 self.ui, subject, self.charsets, self.test
426 )
426 )
427
427
428 # try to make message have proper sender
428 # try to make message have proper sender
@@ -365,13 +365,13 b' def headencode(ui, s, charsets=None, dis'
365 if not display:
365 if not display:
366 # split into words?
366 # split into words?
367 s, cs = _encode(ui, s, charsets)
367 s, cs = _encode(ui, s, charsets)
368 return encoding.strtolocal(email.header.Header(s, cs).encode())
368 return email.header.Header(s, cs).encode()
369 return s
369 return encoding.strfromlocal(s)
370
370
371
371
372 def _addressencode(ui, name, addr, charsets=None):
372 def _addressencode(ui, name, addr, charsets=None):
373 assert isinstance(addr, bytes)
373 assert isinstance(addr, bytes)
374 name = encoding.strfromlocal(headencode(ui, name, charsets))
374 name = headencode(ui, name, charsets)
375 try:
375 try:
376 acc, dom = addr.split(b'@')
376 acc, dom = addr.split(b'@')
377 acc.decode('ascii')
377 acc.decode('ascii')
General Comments 0
You need to be logged in to leave comments. Login now