diff --git a/src/plugins/network/RequestDetails.js b/src/plugins/network/RequestDetails.js index f40dc6cc3..5c3278960 100644 --- a/src/plugins/network/RequestDetails.js +++ b/src/plugins/network/RequestDetails.js @@ -62,11 +62,15 @@ function decodeBody(container: Request | Response): string { if (!container.data) { return ''; } - const b64Decoded = decodeURIComponent(escape(atob(container.data))); + const b64Decoded = atob(container.data); + const body = + getHeaderValue(container.headers, 'Content-Encoding') === 'gzip' + ? decompress(b64Decoded) + : b64Decoded; - return getHeaderValue(container.headers, 'Content-Encoding') === 'gzip' - ? decompress(b64Decoded) - : b64Decoded; + // Data is transferred as base64 encoded bytes to support unicode characters, + // we need to decode the bytes here to display the correct unicode characters. + return decodeURIComponent(escape(body)); } function decompress(body: string): string { diff --git a/src/plugins/network/index.js b/src/plugins/network/index.js index bd90c2478..7a8413573 100644 --- a/src/plugins/network/index.js +++ b/src/plugins/network/index.js @@ -490,7 +490,10 @@ class SizeColumn extends PureComponent<{ if (lengthString != null && lengthString != '') { length = parseInt(lengthString, 10); } else if (response.data) { - length = decodeURIComponent(escape(atob(response.data))).length; + // FIXME: T41427687 This is probably not the correct way to determine + // the correct byte size of the response, because String.length returns + // the number of characters, not bytes. + length = atob(response.data).length; } return length; }