Merge ~binli/checkbox-support/+git/checkbox-support:utf8-decode-error into checkbox-support:master

Proposed by Bin Li
Status: Merged
Merged at revision: a6f43d7ded669efa49228f79d07af97e547d9149
Proposed branch: ~binli/checkbox-support/+git/checkbox-support:utf8-decode-error
Merge into: checkbox-support:master
Diff against target: 13 lines (+1/-1)
1 file modified
checkbox_support/parsers/__init__.py (+1/-1)
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+424931@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Bin Li (binli) wrote :

I also tried use 'replace'
$ checkbox-cli run com.canonical.certification::udev_json | grep LNV
        "product": "LNV-5B10W51860\ufffd\ufffd",
        "product_slug": "LNV-5B10W51860__",
Finalizing session that hasn't been submitted anywhere: checkbox-run-2022-06-17T08.03.06

Using 'ignore'.
$ checkbox-cli run com.canonical.certification::udev_json | grep LNV
        "product": "LNV-5B10W51860",
        "product_slug": "LNV-5B10W51860",

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Thanks a lot, this patch will definitely improve the robustness of out parser.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/checkbox_support/parsers/__init__.py b/checkbox_support/parsers/__init__.py
2index dd928d8..a031a17 100644
3--- a/checkbox_support/parsers/__init__.py
4+++ b/checkbox_support/parsers/__init__.py
5@@ -71,7 +71,7 @@ def main():
6 raise SystemExit()
7 parser = AVAILABLE_PARSERS[args.parser_name]
8 stdin = sys.stdin
9- with io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8') as stdin:
10+ with io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8', errors='ignore') as stdin:
11 try:
12 text = stdin.read()
13 print(run_parsing(parser, text))

Subscribers

People subscribed via source and target branches