[PATCH] mac: fix percent-encoding of non-utf-8 characters (issue4999)

Yuya Nishihara yuya at tcha.org
Sun Dec 13 00:45:22 CST 2015


On Sat, 12 Dec 2015 21:49:10 -0600, Matt Mackall wrote:
> # HG changeset patch
> # User Matt Mackall <mpm at selenic.com>
> # Date 1449977781 21600
> #      Sat Dec 12 21:36:21 2015 -0600
> # Node ID f403693d5f7c139df6c91f77104b89d24c988b2f
> # Parent  944af8e2eb4cddf96ba5b8a96854528b40979715
> mac: fix percent-encoding of non-utf-8 characters (issue4999)
> 
> diff -r 944af8e2eb4c -r f403693d5f7c mercurial/posix.py
> --- a/mercurial/posix.py	Fri Dec 11 17:45:19 2015 -0600
> +++ b/mercurial/posix.py	Sat Dec 12 21:36:21 2015 -0600
> @@ -271,13 +271,13 @@
>              # OS X percent-encodes any bytes that aren't valid utf-8
>              s = ''
>              pos = 0
> -            l = len(s)
> +            l = len(path)
>              while pos < l:
>                  try:
>                      c = encoding.getutf8char(path, pos)
>                      pos += len(c)
>                  except ValueError:
> -                    c = '%%%%02X' % path[pos]
> +                    c = '%%%02X' % ord(path[pos])

Oops, looks good to me. Should I queue this or will you push it to the main
repo? It seems the clowncopter is dead right now.


More information about the Mercurial-devel mailing list