bhollis/jsonview

Wrong character instead of triangle pointing down

Closed this issue · 20 comments

Describe the bug
The plugin worked fine for many months. With the last update 2.4.0, the downward pointing triangle to expand/retract nodes was replaced by an A character rotated 90'
Image

What browser are you using?*
Firefox 112.0.2 in Ubuntu 22.04.2 LTS
In chrome works fine.

Where did you install JSONView from?
Home page

That's pretty exciting - I don't think anything changed with how that works.

Thanks, that's likely it. I've submitted 2.4.1 with the fix.

I dont see v2.4.1 in github or in the FF store, only on chrome store.
There is a revision window before being published?

Yes they have to review it. No idea how long that will take, Firefox has about a week's lag these days.

I have 2.4.1 and the issue is still present: screenshot
And it's not only the arrows but basically any UTF-8 text, like Japanese here: screenshot

Problem solved for me with 2.4.1. TY!

Problem not solved for me

It's not still working for me. I already have that: Screenshot 2023-05-16 at 10 44 25

stanio commented

@balagez, are you able to see https://jsonview.com/example.json fine?

@stanio Yes that works. Here's an example that doesn't: https://kinja.com/api/core/post/1849599382

Edit: Not sure if it matters but https://jsonview.com/example.json returns this header:

content-type: application/json; charset=utf-8

while my example has

content-type: application/json

According to the JSON RFC the default encoding for JSON content is UTF-8 so the explicit charset shouldn't be necessary for the application/json MIME type.

The rfc8259 defines that:

Note:  No "charset" parameter is defined for this registration.
      Adding one really has no effect on compliant recipients.

I thing the plugin must assume utf-8 if no content-type/charset is received.

stanio commented

Here's an example that doesn't: https://kinja.com/api/core/post/1849599382

FWIW, on that "page" I'm seeing the "Repair Text Encoding" item active:

shot1

shot2

After activating it the content is seen fine:

shot3

Not sure what's going on. Saving the file locally with a .json extension and opening that in Firefox, displays it fine this time around.

For later reference it appears that this only happens on Firefox?

stanio commented

For me yes, it appears only in Firefox. The same looks fine in MS Edge, for example.

FWIW, with ASCII-only JSON I'm not getting a "Repair Text Encoding" option and the collapsers remain mangled.

MS Edge hasn't updated because they no longer accept this extension.

stanio commented

In both of my Firefox and Edge extensions, I'm seeing JSONView Version 2.4.1. Could be I've installed it from the Chrome Web Store, don't really remember.

What's happening with the document in https://kinja.com/api/core/post/1849599382 is that it does not specify an encoding, but Firefox is guessing that the encoding is windows-1252. JSONView always parses and transforms to UTF-8, because the JSON spec requires that all valid JSON documents are UTF-8.

JSONView 2.4.2 is going out (in the review queues) which will fix this, but I'd recommend always specifying an encoding.

Now it's working as expected. Whether or not the server should send the encoding is almost a decade old debate, and and both Chromium and Firefox seem to have been non-compliant at some point in the past:

An opinionated framework, such as Play in my case, may not give us the option to change the Content-Type header.

Up until recently Firefox handled it well so I assume it's a recent regression in Firefox. Anyways, thank you for fixing it.

i still get the same problem with 2.6.1 in Firefox 121.0.1

The Fix Encoding Button fixes it temporarly

@bhollis I'm still getting the same issue with 2.6.1 in Firefox 124.0.2. However I do NOT have the "Repair Text Encoding" option available. It's grayed out, so I can't use that as a temporary fix. Screenshot from REST Countries API below.
screenshot