[PATCH 07 of 11] py3: byteify the decoded JSON responses upon receipt in the LFS blobstore
Yuya Nishihara
yuya at tcha.org
Mon Jan 28 06:59:44 EST 2019
On Mon, 28 Jan 2019 00:20:53 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1548629295 18000
> # Sun Jan 27 17:48:15 2019 -0500
> # Node ID b98988169d4a9c7890b93091683fa4ec38d61a47
> # Parent 1d6f4c32abc28ea54e3d1d8487a1d773033aedf0
> py3: byteify the decoded JSON responses upon receipt in the LFS blobstore
> - return response
> + def encodestr(x):
> + if isinstance(x, unicode):
Fixed s/unicode/pycompat.unicode/ in flight.
> + return x.encode(u'utf-8')
> + return x
> +
> + return pycompat.rapply(encodestr, response)
I assume here JSON strings are encoding agnostic (i.e. ASCII.) If the JSON
had a filename for example, it wouldn't be always correct to encode data as
UTF-8.
More information about the Mercurial-devel
mailing list