dnl a .sav file and demonstrates that they are properly read back in.
dnl XXX mrsets tests are missing.
AT_SETUP([system file character encoding])
-AT_CHECK([supports_encodings windows-1252])
+AT_CHECK([i18n-test supports_encodings windows-1252])
AT_DATA([save.sps], [dnl
SET LOCALE='windows-1252'.
DATA LIST LIST NOTABLE /àéîöçxyzabc * roué (A9) croûton (A1000).
length ($out) == 32 or die;
print +a2e ($out);
}],
- [AT_CHECK([supports_encodings EBCDIC-US])])
+ [AT_CHECK([i18n-test supports_encodings EBCDIC-US])])
DATA_READER_BINARY([MODE=360 /RECFORM=VARIABLE],
[for $_ (@data) {
push (@records, pack ("n xx", length ($_) + 4) . a2e ($_));
}
dump_records ();],
- [AT_CHECK([supports_encodings EBCDIC-US])])
+ [AT_CHECK([i18n-test supports_encodings EBCDIC-US])])
DATA_READER_BINARY([MODE=360 /RECFORM=SPANNED],
[[for my $line (@data) {
}
}
dump_records ();]],
- [AT_CHECK([supports_encodings EBCDIC-US])])
+ [AT_CHECK([i18n-test supports_encodings EBCDIC-US])])
AT_SETUP([UTF-8])
AT_KEYWORDS([encoding guesser])
-AT_CHECK([supports_encodings ISO-8859-1])
+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([supports_encodings ISO-8859-1])
+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([ISO-8859-1])
AT_KEYWORDS([encoding guesser])
-AT_CHECK([supports_encodings ISO-8859-1])
+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_SETUP([GB-18030 with byte order mark])
AT_KEYWORDS([encoding guesser])
-AT_CHECK([supports_encodings ISO-8859-1])
+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_SETUP([UTF-EBCDIC with byte order mark])
AT_KEYWORDS([encoding guesser])
-AT_CHECK([supports_encodings ISO-8859-1])
+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_SETUP([EUC-JP as Auto,EUC-JP])
AT_KEYWORDS([encoding guesser])
-AT_CHECK([supports_encodings EUC-JP])
+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_SETUP([EUC-JP starting with ASCII as Auto,EUC-JP])
AT_KEYWORDS([encoding guesser])
-AT_CHECK([supports_encodings EUC-JP])
+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_SETUP([UTF-8 with character split across input buffers])
AT_KEYWORDS([encoding guesser])
-AT_CHECK([supports_encodings ISO-8859-1])
+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
])
/* PSPP - a program for statistical analysis.
- Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
{
i18n_init ();
+ if (argc > 1 && !strcmp (argv[1], "supports_encodings"))
+ {
+ int status = 0;
+ int i;
+
+ for (i = 2; i < argc; i++)
+ if (!is_encoding_supported (argv[i]))
+ {
+ printf ("encoding \"%s\" is NOT supported\n", argv[i]);
+ status = 77;
+ }
+ i18n_done ();
+ exit (status);
+ }
if (argc == 5 && !strcmp (argv[1], "recode"))
{
const char *from = argv[2];
else
{
fprintf (stderr, "\
+usage: %s supports_encodings ENCODING...\n\
+where ENCODING is the name of an encoding.\n\
+Exits with status 0 if all the encodings are supported, 77 otherwise.\n\
+\n\
usage: %s recode FROM TO STRING\n\
where FROM is the source encoding,\n\
TO is the target encoding,\n\
TAIL is the second string to concatenate\n\
ENCODING is the encoding in which to measure the result's length\n\
MAX_LEN is the maximum length of the result in ENCODING.\n",
- argv[0], argv[0]);
+ argv[0], argv[0], argv[0]);
return EXIT_FAILURE;
}
AT_BANNER([i18n recoding])
-m4_divert_push([PREPARE_TESTS])
-supports_encodings () {
- case "$host" in
- *-*-linux* | *-*-*-gnu*)
- dnl GNU/Linux always has the encodings we want. We can't ask
- dnl config.charset about them because it has a special case here
- dnl too and won't tell us.
- return 0
- ;;
- *)
- for encoding in "$@"; do
- $SHELL $top_srcdir/gl/config.charset "$host" | grep '$2' || return 77
- done
- ;;
- esac
-}
-m4_divert_pop([PREPARE_TESTS])
-
# CHECK_I18N_RECODE([TITLE], [FROM-CODING], [TO-CODING],
# [FROM-TEXT], [TO-TEXT])
#
AT_KEYWORDS([i18n])
dnl Skip the test if this host doesn't know the source and target encodings.
- AT_CHECK([supports_encodings '$2' '$3'])
+ AT_CHECK([i18n-test supports_encodings '$2' '$3'])
AT_CHECK_UNQUOTED([i18n-test recode '$2' '$3' `printf '$4'`], [0], [`printf '$5'`
])
AT_CLEANUP])
AT_KEYWORDS([i18n])
dnl Skip the test if this host doesn't know the encoding.
- AT_CHECK([supports_encodings '$3'])
+ AT_CHECK([i18n-test supports_encodings '$3'])
AT_CHECK_UNQUOTED(
[i18n-test concat "`printf '$1'`" "`printf '$2'`" '$3' '$4'], [0],
[`printf '$5'`
AT_SETUP([read ASCII])
AT_KEYWORDS([u8_istream])
-AT_CHECK([supports_encodings ASCII])
+AT_CHECK([i18n-test supports_encodings ASCII])
AT_CHECK([echo string | u8-istream-test read - ASCII], [0], [string
])
AT_CLEANUP
AT_SETUP([read EUC-JP])
AT_KEYWORDS([u8_istream])
-AT_CHECK([supports_encodings EUC-JP])
+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' | u8-istream-test read - EUC-JP],
[0],
[ぁ あ ぃ い ぅ う ぇ え ぉ お
AT_SETUP([read EUC-JP with character split across input buffers])
AT_KEYWORDS([u8_istream])
-AT_CHECK([supports_encodings EUC-JP])
+AT_CHECK([i18n-test supports_encodings EUC-JP])
buffer_size=`u8-istream-test buffer-size`
($PERL -e "print 'x' x ($buffer_size - 16)"
printf '\244\241 \244\242 \244\243 \244\244 \244\245 \244\246 \244\247 '
AT_SETUP([read EUC-JP with character split across output buffers])
AT_KEYWORDS([u8_istream])
-AT_CHECK([supports_encodings EUC-JP])
+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' | u8-istream-test read - EUC-JP 16],
[0],
[ぁあぃいぅうぇえぉお
AT_SETUP([read EUC-JP with character split across input and output buffers])
AT_KEYWORDS([u8_istream])
-AT_CHECK([supports_encodings EUC-JP])
+AT_CHECK([i18n-test supports_encodings EUC-JP])
buffer_size=`u8-istream-test buffer-size`
($PERL -e "print 'x' x ($buffer_size - 16)"
printf 'xyz\244\241\244\242\244\243\244\244\244\245\244\246\244\247\244\250'
AT_SETUP([read ISO-8859-1 as Auto,ISO-8859-1])
AT_KEYWORDS([u8_istream])
-AT_CHECK([supports_encodings ISO-8859-1])
+AT_CHECK([i18n-test supports_encodings ISO-8859-1])
buffer_size=`u8-istream-test buffer-size`
($PERL -e "print 'x' x int($buffer_size * 2.5)"; printf 'entr\351e\n') > input
(echo "Auto mode"
dnl UTF-16BE is not ASCII compatible so this doesn't start out in Auto mode.
AT_SETUP([read UTF-16BE as Auto,UTF-16BE])
AT_KEYWORDS([u8_istream])
-AT_CHECK([supports_encodings UTF-16BE])
+AT_CHECK([i18n-test supports_encodings UTF-16BE])
AT_CHECK([printf '\0e\0n\0t\0r\0\351\0e\0\n' | u8-istream-test read - Auto,UTF-16BE],
[0], [dnl
entrée
AT_SETUP([read EUC-JP as Auto,EUC-JP])
AT_KEYWORDS([u8_istream])
-AT_CHECK([supports_encodings EUC-JP])
+AT_CHECK([i18n-test supports_encodings EUC-JP])
AT_CHECK([printf 'entr\217\253\261e\n' | u8-istream-test read - Auto,EUC-JP],
[0], [entrée
])