1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
|
dnl PSPP - a program for statistical analysis.
dnl Copyright (C) 2017 Free Software Foundation, Inc.
dnl
dnl This program is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
dnl
AT_BANNER([encoding guesser])
AT_SETUP([ASCII])
AT_KEYWORDS([encoding guesser])
AT_CHECK([echo string | encoding-guesser-test Auto,ISO-8859-1], [0], [ASCII
])
AT_CLEANUP
AT_SETUP([UTF-8])
AT_KEYWORDS([encoding guesser])
AT_CHECK([i18n-test supports_encodings ISO-8859-1])
AT_CHECK([printf '\346\227\245\346\234\254\350\252\236\n' | encoding-guesser-test Auto,ISO-8859-1], [0], [UTF-8
])
AT_CLEANUP
AT_SETUP([UTF-8 starting with ASCII])
AT_KEYWORDS([encoding guesser])
AT_CHECK([i18n-test supports_encodings ISO-8859-1])
AT_CHECK([printf 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\346\227\245\346\234\254\350\252\236\n' | encoding-guesser-test Auto,ISO-8859-1 32], [0], [UTF-8
])
AT_CLEANUP
AT_SETUP([UTF-16 with big-endian byte order mark])
AT_KEYWORDS([encoding guesser])
AT_CHECK([printf '\376\377' | encoding-guesser-test Auto,ISO-8859-1],
[0], [UTF-16
])
AT_CLEANUP
AT_SETUP([UTF-16 with little-endian byte order mark])
AT_KEYWORDS([encoding guesser])
AT_CHECK([printf '\377\376' | encoding-guesser-test Auto,ISO-8859-1],
[0], [UTF-16
])
AT_CLEANUP
AT_SETUP([UTF-16BE])
AT_KEYWORDS([encoding guesser])
AT_CHECK([printf '\0e\0n\0t\0r\0\351\0e\0\n' | encoding-guesser-test Auto,ISO-8859-1],
[0], [UTF-16BE
])
AT_CLEANUP
dnl Unicode U+XX00 characters are confusing in UTF-16 because they look
dnl likely to be of the opposite endianness, so this tests for proper handling.
AT_SETUP([UTF-16BE starting with U+0100])
AT_KEYWORDS([encoding guesser])
AT_CHECK([printf '\1\0\0e\0n\0t\0r\0\351\0e\0\n' | encoding-guesser-test Auto,ISO-8859-1],
[0], [UTF-16BE
])
AT_CLEANUP
AT_SETUP([UTF-16LE])
AT_KEYWORDS([encoding guesser])
AT_CHECK([printf 'e\0n\0t\0r\0\351\0e\0\n\0' | encoding-guesser-test Auto,ISO-8859-1],
[0], [UTF-16LE
])
AT_CLEANUP
dnl Unicode U+XX00 characters are confusing in UTF-16 because they look
dnl likely to be of the opposite endianness, so this tests for proper handling.
AT_SETUP([UTF-16LE starting with U+0100])
AT_KEYWORDS([encoding guesser])
AT_CHECK([printf '\0\1e\0n\0t\0r\0\351\0e\0\n\0' | encoding-guesser-test Auto,ISO-8859-1],
[0], [UTF-16LE
])
AT_CLEANUP
AT_SETUP([UTF-32 with big-endian byte order mark])
AT_KEYWORDS([encoding guesser])
AT_CHECK([printf '\0\0\376\377' | encoding-guesser-test Auto,ISO-8859-1],
[0], [UTF-32
])
AT_CLEANUP
AT_SETUP([UTF-32 with little-endian byte order mark])
AT_KEYWORDS([encoding guesser])
AT_CHECK([printf '\377\376\0\0' | encoding-guesser-test Auto,ISO-8859-1],
[0], [UTF-32
])
AT_CLEANUP
AT_SETUP([UTF-32BE])
AT_KEYWORDS([encoding guesser])
AT_CHECK([printf '\0\0\0e\0\0\0n\0\0\0t\0\0\0r\0\0\0\351\0\0\0e\0\0\0\n' | encoding-guesser-test Auto,ISO-8859-1],
[0], [UTF-32BE
])
AT_CLEANUP
AT_SETUP([UTF-32LE])
AT_KEYWORDS([encoding guesser])
AT_CHECK([printf 'e\0\0\0n\0\0\0t\0\0\0r\0\0\0\351\0\0\0e\0\0\0\n\0\0\0' | encoding-guesser-test Auto,ISO-8859-1],
[0], [UTF-32LE
])
AT_CLEANUP
AT_SETUP([ISO-8859-1])
AT_KEYWORDS([encoding guesser])
AT_CHECK([i18n-test supports_encodings ISO-8859-1])
AT_CHECK([printf 'entr\351e\n' | encoding-guesser-test Auto,ISO-8859-1],
[0], [ISO-8859-1
])
AT_CLEANUP
AT_SETUP([GB-18030 with byte order mark])
AT_KEYWORDS([encoding guesser])
AT_CHECK([i18n-test supports_encodings ISO-8859-1])
AT_CHECK([printf '\204\061\225\063' | encoding-guesser-test Auto,ISO-8859-1],
[0], [GB-18030
])
AT_CLEANUP
AT_SETUP([UTF-EBCDIC with byte order mark])
AT_KEYWORDS([encoding guesser])
AT_CHECK([i18n-test supports_encodings ISO-8859-1])
AT_CHECK([printf '\335\163\146\163' | encoding-guesser-test Auto,ISO-8859-1],
[0], [UTF-EBCDIC
])
AT_CLEANUP
AT_SETUP([EUC-JP as Auto,EUC-JP])
AT_KEYWORDS([encoding guesser])
AT_CHECK([i18n-test supports_encodings EUC-JP])
AT_CHECK([printf '\244\241 \244\242 \244\243 \244\244 \244\245 \244\246 \244\247 \244\250 \244\251 \244\252\n' | encoding-guesser-test Auto,EUC-JP],
[0], [EUC-JP
])
AT_CLEANUP
AT_SETUP([EUC-JP starting with ASCII as Auto,EUC-JP])
AT_KEYWORDS([encoding guesser])
AT_CHECK([i18n-test supports_encodings EUC-JP])
AT_CHECK([printf 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \244\241 \244\242 \244\243 \244\244 \244\245 \244\246 \244\247 \244\250 \244\251 \244\252\n' | encoding-guesser-test Auto,EUC-JP 32],
[0], [EUC-JP
])
AT_CLEANUP
AT_SETUP([UTF-8 with character split across input buffers])
AT_KEYWORDS([encoding guesser])
AT_CHECK([i18n-test supports_encodings ISO-8859-1])
AT_CHECK([printf '\343\201\201\343\201\202\343\201\203\343\201\204\343\201\205\343\201\206\343\201\207\343\201\210\343\201\211\343\201\212\343\201\201\343\201\202\343\201\203\343\201\204\343\201\205\343\201\206\343\201\207\343\201\210\343\201\211\343\201\212\n' | encoding-guesser-test Auto,ISO-8859-1 32],
[0], [UTF-8
])
AT_CLEANUP
AT_SETUP([windows-1252 as Auto,UTF-8])
AT_KEYWORDS([encoding guesser])
AT_CHECK([i18n-test supports_encodings windows-1252])
AT_CHECK([printf 'entr\351e' | encoding-guesser-test Auto,UTF-8 32], [0],
[windows-1252
])
AT_CLEANUP
|