Debian Codegraph @

src/tests/testtext.sh

raw
1 #!/bin/sh
2
3 testtext="test.txt"
4
5 echo "/* Test strings generated by $0, using data from $testtext */"
6 echo
7
8 for i in latin1 cp1252 utf8 utf16 utf16bom_le utf16le utf16bom_be utf16be
9 do
10 enc=$i
11 bom=
12 case $i in
13 utf16bom_be)
14 enc=utf16be
15 bom="0xfe, 0xff, ";
16 ;;
17 utf16bom_le*)
18 enc=utf16le
19 bom="0xff, 0xfe, ";
20 ;;
21 esac
22
23 echo "const unsigned char ${i}[] = "
24 echo -n "{ $bom"
25 iconv -f utf8 -t $enc < "$testtext" | hexdump -v -e '1/1 "0x%02x, "'
26 echo
27 case $i in
28 latin1|utf8|cp1252)
29 echo " 0x00 };"
30 ;;
31 utf16*)
32 echo " 0x00, 0x00 };"
33 ;;
34 esac
35 echo
36 done