]> git.ipfire.org Git - thirdparty/git.git/blame - t/lib-encoding.sh
Sync with Git 2.45.1
[thirdparty/git.git] / t / lib-encoding.sh
CommitLineData
2fa3cbad
MT
1# Encoding helpers
2
3test_lazy_prereq NO_UTF16_BOM '
4 test $(printf abc | iconv -f UTF-8 -t UTF-16 | wc -c) = 6
5'
6
7test_lazy_prereq NO_UTF32_BOM '
8 test $(printf abc | iconv -f UTF-8 -t UTF-32 | wc -c) = 12
9'
10
11write_utf16 () {
12 if test_have_prereq NO_UTF16_BOM
13 then
14 printf '\376\377'
15 fi &&
16 iconv -f UTF-8 -t UTF-16
17}
18
19write_utf32 () {
20 if test_have_prereq NO_UTF32_BOM
21 then
22 printf '\0\0\376\377'
23 fi &&
24 iconv -f UTF-8 -t UTF-32
25}