From 0d480e380ce6a2037ee6d1316f713e6ac6d97a01 Mon Sep 17 00:00:00 2001 From: Hirochika Matsumoto Date: Wed, 29 Sep 2021 23:15:30 +0900 Subject: [PATCH 1/2] rustdoc-json: Always encode with UTF-8 when opening json files --- src/etc/check_missing_items.py | 2 +- src/test/rustdoc-json/emoji.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 src/test/rustdoc-json/emoji.rs diff --git a/src/etc/check_missing_items.py b/src/etc/check_missing_items.py index 7572b8c6f4a8c..7ed317c778fce 100644 --- a/src/etc/check_missing_items.py +++ b/src/etc/check_missing_items.py @@ -9,7 +9,7 @@ import sys import json -crate = json.load(open(sys.argv[1])) +crate = json.load(open(sys.argv[1], encoding="utf-8")) def get_local_item(item_id): diff --git a/src/test/rustdoc-json/emoji.rs b/src/test/rustdoc-json/emoji.rs new file mode 100644 index 0000000000000..727045ef8bbcf --- /dev/null +++ b/src/test/rustdoc-json/emoji.rs @@ -0,0 +1,6 @@ +//! 🦀 + +// edition:2018 +// compile-flags: --crate-version 1.0.0 + +// @is emoji.json "$.crate_version" '"1.0.0"' From 9f36189bf794fb347c1cfeab08b280454450d340 Mon Sep 17 00:00:00 2001 From: Hirochika Matsumoto Date: Wed, 29 Sep 2021 23:21:53 +0900 Subject: [PATCH 2/2] This may fail --- src/etc/check_missing_items.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/etc/check_missing_items.py b/src/etc/check_missing_items.py index 7ed317c778fce..7572b8c6f4a8c 100644 --- a/src/etc/check_missing_items.py +++ b/src/etc/check_missing_items.py @@ -9,7 +9,7 @@ import sys import json -crate = json.load(open(sys.argv[1], encoding="utf-8")) +crate = json.load(open(sys.argv[1])) def get_local_item(item_id):