canonical / canonical/multipass

Support text files with a Byte Order Mark (BOM)

Open
#1,634 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
9.2k
Forks
829
Avg merge
3d 2h
Merged PRs (30d)
45

Description

**Describe the bug**
Reported in https://github.com/canonical/multipass/issues/1585#issuecomment-655386924, the user had a JSON file that included a [BOM](https://en.wikipedia.org/wiki/Byte_order_mark) and we (the Terminal integration) choked on it.

This would apply to any and all text files we're reading.

[QTextCodec](https://doc.qt.io/qt-5/qtextcodec.html) and [QTextStream](https://doc.qt.io/qt-5/qtextstream.html) look like they could be used here.

**To Reproduce**
1. have a BOM in Terminal's `settings.json`
1. `multipass ...` (whatever)

**Expected behavior**
The file to be read correctly.

Contributor guide

Open the contributing guide

Research direction

Start with the Terminal integration code that reads settings.json and reproduce the issue using a file containing a BOM. Review the possible QTextCodec and QTextStream approaches mentioned in the issue, then verify that settings.json and other text files are read correctly when they include a BOM.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.