Closed Bug 1797871 Opened 3 years ago Closed 3 years ago

Windows 11 Firefox browser throws a parsing error when used to open utf-16 encoded Json text files.

Categories

(DevTools :: JSON Viewer, defect)

32 Branch
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1396286

People

(Reporter: GCUser99, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.52

Steps to reproduce:

Save a text file in UTF-16le or UTF-16be using Windows 11 notepad or using vbscript FileSystemObject.CreateTextFile().
Find the file created above using File Explorer, rmb click and open with Firefox browser. Or alternatively, open browser and drag-drop json text file into browser window.

Actual results:

Firefox browser opens/changes to json viewer mode.
Firefox "JSON" tab shows "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data"
Firefox "Raw Data" tab shows the json text prefixed by two black diamond question mark characters.

Expected results:

JSON tab should show a table of json keys and values.

It works perfectly if the input json file is saved in UTF-8 format.

The Bugbug bot thinks this bug should belong to the 'Core::Widget: Win32' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Widget: Win32
Product: Firefox → Core
Component: Widget: Win32 → JSON Viewer
Product: Core → DevTools

Probably a duplicate of bug 1396286.
I did add support for UTF-16, but then was told to remove it :(

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Duplicate of bug: 1396286
Resolution: --- → DUPLICATE

utf-16 is a windows standard. Also, I can open other text file types in utf-16 such as .xml and .html using Firefox, so lack of support for utf-16 .json files seems rather inconsistent. Please reconsider... thx

  1. UTF-8 is the only valid JSON encoding per RFC 8259.
  2. Windows 11 Notepad uses UTF-8 (not UTF-16LE) as the default text encoding.
  3. Windows lost a power to force their way to rest of the world.

On your #3 above, I was not trying to make a political statement about windows or power - just trying to help make Firefox more robust.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: