How about using "dn = str(Header(uvia, lcs))" instead of "dn = str(Header(uvia, 'utf-8'))" ? As variable uvia is always unicode, there is no afraid to be mistaken encodings. Header() treats charset parameter only for a hint, so it uses 'utf-8' as the fall back if it fail to encode to lcs.
test case 1. list's language : fr (iso-8859-1) sender's language : fr (iso-8859-1) sender's display name : =?iso-8859-1?q?G=E9n=E9rales?= (results) From: =?iso-8859-1?q?G=E9n=E9rales_via_Mailman-test?= <...> test case 2. list's language : ja (euc-jp, out going messages are encoded to iso-2022-jp) sender's language : ja (euc-jp, out going messages are encoded to iso-2022-jp) sender's display name : =?ISO-2022-JP?B?GyRCRnNMWkx3P04bKEI=?= (results) From: =?iso-2022-jp?b?GyRCRnNMWkx3P04bKEIgKE1haWxtYW4tdGVzdCAbJEI3UE0zGyhCKQ==?= <...> test case 3. list's language : en (us-ascii) sender's language : en (us-ascii) sender's display name : Yasuhito FUTATSUKI (results) From: Yasuhito FUTATSUKI via Mailman-test <...> test case 4. list's language : fr (iso-8859-1) sender's language : ja (euc-jp, out going messages are encoded to iso-2022-jp) sender's display name : =?UTF-8?B?5LqM5pyoIOmdluS7gQ==?= (results) From: =?utf-8?b?5LqM5pyoIOmdluS7gSB2aWEgTWFpbG1hbi10ZXN0?= <...> in all of above, it looks fine. -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/1643210 Title: 'from_is_list' does not RFC2047 encode correctly when translation contains non-ascii char To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/1643210/+subscriptions _______________________________________________ Mailman-coders mailing list [email protected] https://mail.python.org/mailman/listinfo/mailman-coders
