diff mbox

[U-Boot] patman and non-ascii names

Message ID CAFOYHZD5s0SHCesmXCVw6SR+phMCPn9tSHLvF6L72Vd1EkhfgA@mail.gmail.com
State Superseded
Delegated to: Simon Glass
Headers show

Commit Message

Chris Packham Jan. 25, 2017, 9:55 a.m. UTC
On Wed, Jan 25, 2017 at 10:33 PM, Chris Packham <judge.packham@gmail.com> wrote:
> Hi All,
>
> Just ran into an issue with patman. It's picking up David Müller as a
> cc recipient. But seems to barf because of the non-ascii characters in
> his name
>
>
>   File "./tools/patman/patman", line 159, in <module>
>     options.add_maintainers)
>   File "./tools/patman/series.py", line 238, in MakeCcFile
>     print(cover_fname, ', '.join(set(cover_cc + all_ccs)), file=fd)
>   UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> 8: ordinal not in range(128)
>
> When I exclude the patch that David's picked as a Cc there is no problem.
>
> Any suggestions. I assume something involving .decode('utf-8') is required.
>

This seems to work for me but the decode()/encode() makes me think
something is more complicated than it needs to be.

         return fname

Comments

Simon Glass Feb. 6, 2017, 3:32 p.m. UTC | #1
Hi Chris,

On 25 January 2017 at 01:55, Chris Packham <judge.packham@gmail.com> wrote:
> On Wed, Jan 25, 2017 at 10:33 PM, Chris Packham <judge.packham@gmail.com> wrote:
>> Hi All,
>>
>> Just ran into an issue with patman. It's picking up David Müller as a
>> cc recipient. But seems to barf because of the non-ascii characters in
>> his name
>>
>>
>>   File "./tools/patman/patman", line 159, in <module>
>>     options.add_maintainers)
>>   File "./tools/patman/series.py", line 238, in MakeCcFile
>>     print(cover_fname, ', '.join(set(cover_cc + all_ccs)), file=fd)
>>   UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
>> 8: ordinal not in range(128)
>>
>> When I exclude the patch that David's picked as a Cc there is no problem.
>>
>> Any suggestions. I assume something involving .decode('utf-8') is required.
>>
>
> This seems to work for me but the decode()/encode() makes me think
> something is more complicated than it needs to be.
>
> diff --git a/tools/patman/series.py b/tools/patman/series.py
> index 38a452edad41..c1b86521aa45 100644
> --- a/tools/patman/series.py
> +++ b/tools/patman/series.py
> @@ -235,7 +235,8 @@ class Series(dict):
>
>          if cover_fname:
>              cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
> -            print(cover_fname, ', '.join(set(cover_cc + all_ccs)), file=fd)
> +            cc_list = ', '.join([x.decode('utf-8') for x in
> set(cover_cc + all_ccs)])
> +            print(cover_fname, cc_list.encode('utf-8'), file=fd)
>
>          fd.close()
>          return fname

This seems reasonable - can you send this as a patch please?

Regards,
Simon
diff mbox

Patch

diff --git a/tools/patman/series.py b/tools/patman/series.py
index 38a452edad41..c1b86521aa45 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -235,7 +235,8 @@  class Series(dict):

         if cover_fname:
             cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
-            print(cover_fname, ', '.join(set(cover_cc + all_ccs)), file=fd)
+            cc_list = ', '.join([x.decode('utf-8') for x in
set(cover_cc + all_ccs)])
+            print(cover_fname, cc_list.encode('utf-8'), file=fd)

         fd.close()