From 6522ee76cb09a3c97ea3ee002b81343a20473ee3 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 1 Oct 2026 18:04:18 -1000 Subject: Replace the stray bytes of text that is not UTF-8 A commit whose encoding header names something iconv cannot convert, or whose text is labelled UTF-8 without being it, reached a page declared UTF-8 with its bytes untouched. The atom feed already replaced them, so its UTF-8 reader moves to shared.c and every ident, subject, message and tag text passes through it. --- tests/t0106-commit.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests/t0106-commit.sh') diff --git a/tests/t0106-commit.sh b/tests/t0106-commit.sh index 39f1822..2b924a0 100755 --- a/tests/t0106-commit.sh +++ b/tests/t0106-commit.sh @@ -37,4 +37,23 @@ test_expect_success 'root commit contains diff' ' grep "
+1
" tmp ' +# A message that is not UTF-8, because its encoding header names something +# iconv cannot convert or is missing altogether, would otherwise reach a +# page declared UTF-8 as it is, so its stray bytes become question marks. +test_expect_success 'a message that is not UTF-8 has its stray bytes replaced' ' + ( + cd repos/foo && + tree=$(git rev-parse HEAD^{tree}) && + printf "tree %s\nauthor A U Thor 1735689600 +0000\n" "$tree" >raw && + printf "committer A U Thor 1735689600 +0000\n" >>raw && + printf "encoding no-such-charset\n\ncaf\351 subject\n\nbody \377 end\n" >>raw && + cid=$(git hash-object --literally -t commit -w raw) && + git update-ref refs/heads/latin "$cid" + ) && + cgit_query "url=foo/commit&h=latin" >tmp && + grep "
caf? subject<" tmp && + grep "body ? end" tmp && + ! grep "caf$(printf "\351")" tmp +' + test_done -- cgit v2.8.0