On Tue, Dec 15, 2020 at 07:47:59PM +0900, Yasuhito FUTATSUKI wrote: > As far as I read the code again, it seems this is already support > locales other than C/C.UTF-8 if mailer.py is kicked with appropriate > LC_CTYPE environment. The REPOS-PATH argment comes from sys.argv[2] > already decoded in file system encoding (i.e. encoding corresponding > to LC_CTYPE) and Python encodes it if access to file system. On the > other hand, svn.repos.open() wrapper function accepts str and encode > it to UTF-8 string, as the svn_repos_open() C API expects. > > Then I overlooked sys.argv[x] and cmd_args[x] in main() are > already str. > > Perhaps it needs (although the last hunk is not nessesary):
Yes, indeed. If python already encodes arguments to strings then this patch looks correct to me. It also works as expected in my testing. > [[[ > Index: tools/hook-scripts/mailer/mailer.py > =================================================================== > --- tools/hook-scripts/mailer/mailer.py (revision 1884434) > +++ tools/hook-scripts/mailer/mailer.py (working copy) > @@ -88,10 +88,10 @@ > messenger = Commit(pool, cfg, repos) > elif cmd == 'propchange' or cmd == 'propchange2': > revision = int(cmd_args[0]) > - author = cmd_args[1].decode('utf-8') > - propname = cmd_args[2].decode('utf-8') > + author = cmd_args[1] > + propname = cmd_args[2] > if cmd == 'propchange2' and cmd_args[3]: > - action = cmd_args[3].decode('utf-8') > + action = cmd_args[3] > else: > action = 'A' > repos = Repository(repos_dir, revision, pool) > @@ -103,7 +103,7 @@ > }) > messenger = PropChange(pool, cfg, repos, author, propname, action) > elif cmd == 'lock' or cmd == 'unlock': > - author = cmd_args[0].decode('utf-8') > + author = cmd_args[0] > repos = Repository(repos_dir, 0, pool) ### any old revision will do > # Override the repos revision author with the author of the lock/unlock > repos.author = author > @@ -1510,7 +1510,7 @@ > usage() > > cmd = sys.argv[1] > - repos_dir = svn.core.svn_path_canonicalize(sys.argv[2]) > + repos_dir = svn.core.svn_path_canonicalize(sys.argv[2].encode('utf-8')) > repos_dir = repos_dir.decode('utf-8') > try: > expected_args = cmd_list[cmd] > ]]]