patman and non-ascii names
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.
Thanks,
Chris
Quoted 10 lines · Chris Packham
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
Quoted 8 lines
print(cover_fname, ', '.join(set(cover_cc + all_ccs)), file=fd)UnicodeDecodeError: 'ascii' codec can't decode byte
0xc3in 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.
tools/patman/series.py +1 -1
@@ -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 fnameHi Chris,
Quoted 37 lines · Chris Packham
Quoted 10 lines · Chris Packham
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 MakeCcFileQuoted 8 lines
print(cover_fname, ', '.join(set(cover_cc + all_ccs)), file=fd)UnicodeDecodeError: 'ascii' codec can't decode byte
0xc3in 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.
tools/patman/series.py +2
-1@@ -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()
Quoted 1 line
return fname
This seems reasonable - can you send this as a patch please?
Regards,
Simon
PATCH 1/1 patman: Handle non-ascii characters in names
When gathering addresses for the Cc list patman would encounter a UnicodeDecodeError due to non-ascii characters in the author name. Address this by explicitly using utf-8 when building the Cc list.
---
Quoted 2 lines · Simon Glass
Hi Chris,
<snip>
Quoted 5 lines
This seems reasonable - can you send this as a patch please?
Regards,
Simon
Here you go. I've only been able to test with python 2.7 but I think it should be fine for python 3.x also.
tools/patman/series.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/patman/series.py +2 -1
@@ -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
Signature · 1 line
2.11.0.24.ge6920cf
PATCH 1/1 patman: Handle non-ascii characters in names
Quoted 13 lines · Chris Packham
When gathering addresses for the Cc list patman would encounter a UnicodeDecodeError due to non-ascii characters in the author name. Address this by explicitly using utf-8 when building the Cc list.
Signed-off-by Chris Packham <[email protected]>---
Quoted 2 lines · Simon Glass
Hi Chris,
<snip>
Quoted 3 lines
This seems reasonable - can you send this as a patch please?
Quoted 8 lines
Quoted 2 lines
Regards,
SimonHere you go. I've only been able to test with python 2.7 but I think it should be fine for python 3.x also.
tools/patman/series.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
PATCH 1/1 patman: Handle non-ascii characters in names
Quoted 17 lines · Simon Glass
Quoted 16 lines · Chris Packham
When gathering addresses for the Cc list patman would encounter a UnicodeDecodeError due to non-ascii characters in the author name. Address this by explicitly using utf-8 when building the Cc list.
Signed-off-by Chris Packham <[email protected]>---
Quoted 2 lines · Simon Glass
Hi Chris,
<snip>
Quoted 5 lines
This seems reasonable - can you send this as a patch please?
Regards,
Simon
Quoted 7 lines
Quoted 5 lines
Here you go. I've only been able to test with python 2.7 but I think it should be fine for python 3.x also.
tools/patman/series.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)Acked-by Simon Glass <[email protected]>
Applied to u-boot-dm, thanks!