Character encoding error

In the developer tools, when viewing the response json content, there is a possibility that the character content cannot be displayed.

This is the content of the response. It is a very large json. I found that the developer tools often cannot display the Chinese characters in it. But sometimes it is normal again.

This is the incorrect content that I get when I use the “raw” mode. There is a problem with the character encoding in some parts of it.

In addition, when using “raw” mode, the browser hangs for a few seconds.

The screenshot is here.

I saved the JSON UTF-8 encoded on my local Windows 10 machine and served it using PHP 8.0.7.

With that configuration I could not reproduce your issue on Firefox 89. I.e. all characters where displayed correctly. Here’s a screenshot showing it partially:

JSON with Chinese characters in Response view

It might be that the problem is on the server side. Did you already try in other browsers to check whether it is a Firefox-only issue? Do you have a public URL where you can reproduce the problem?

Sebastian

1 Like

Thank you for your reply. I think this is not a server-side problem. I did not find this problem in the edge browser. In addition, although the character encoding displayed in the developer tools is wrong, the characters displayed on the browser page are correct. If it is a service End error, then every request of the same interface should display the error character. And now it is sometimes wrong.
The worst part is that I can’t reproduce this problem stably. I can only try to resend the request all the time. I wrote a simple Java application to return json to Firefox, but there is no problem.

I found a website that can always reproduce the problem. This is Microsoft’s .Net document:https://docs.microsoft.com/zh-cn/dotnet/core/get-started.
Note that the language is Chinese. Open the developer tool and you will see this request:https://docs.microsoft.com/zh-cn/dotnet/breadcrumb/toc.json.
In response:items->0->children->0->children,The serial number 6, 7, 8, 9, 10 may be wrong.
Their toc_title all contain Chinese. And unlike what I described before, the response of this link has always been character encoding wrong.
Again, there is no such problem in the edge browser.

firefox developer edition : 90.0b5 (64-bit).
At least in October last year, I found such problems.

Hi again and sorry for the late reply!

Thank you for the test case and the steps to reproduce it! With that I could confirm that this is a bug in the DevTools. I’ve filed it as bug 1716245.

For what it’s worth, it seems the JSON Viewer outside the Network Monitor doesn’t seem to be affected. I.e. when you open the JSON file in a new tab and look at its contents there, the encoding is correct.
So you might use that as a workaround for the issue until the bug is fixed.

Sebastian