blob: 2dabc8c73edf3ab0e5de5179a5370f1c8416e29c [file] [log] [blame]
Matheus Tavares2fa3cba2021-05-04 13:27:33 -03001# 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}