X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=test%2Ftest-lib.sh;h=fd64736bec562ede98be40ecda5ed3eab5e021f0;hb=452f8748c45d38b96706cc04e7b2dc98fc72ec78;hp=f1697856426225f2df4de7a6ca9c5c8a384333e5;hpb=7a0813b72a04339581dfbe06fb9a6de9bc161025;p=notmuch diff --git a/test/test-lib.sh b/test/test-lib.sh index f1697856..fd64736b 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -534,8 +534,13 @@ test_expect_equal_file () # canonicalized before diff'ing. If an argument cannot be parsed, it # is used unchanged so that there's something to diff against. test_expect_equal_json () { - output=$(echo "$1" | python -mjson.tool || echo "$1") - expected=$(echo "$2" | python -mjson.tool || echo "$2") + # The test suite forces LC_ALL=C, but this causes Python 3 to + # decode stdin as ASCII. We need to read JSON in UTF-8, so + # override Python's stdio encoding defaults. + output=$(echo "$1" | PYTHONIOENCODING=utf-8 python -mjson.tool \ + || echo "$1") + expected=$(echo "$2" | PYTHONIOENCODING=utf-8 python -mjson.tool \ + || echo "$2") shift 2 test_expect_equal "$output" "$expected" "$@" } @@ -576,7 +581,7 @@ NOTMUCH_NEW () notmuch_search_sanitize () { - sed -r -e 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/' + perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/' } NOTMUCH_SHOW_FILENAME_SQUELCH='s,filename:.*/mail,filename:/XXX/mail,'