does not support.
SVN-Revision: 3035
#include <sys/time.h>
#endif
#include <errno.h>
+#ifdef HAVE_ICONV_H
+#include <iconv.h>
+#endif
#include <limits.h>
#include <locale.h>
#include <stdarg.h>
return (value);
}
+/*
+ * Can this platform convert character-set.
+ */
+int
+canConvertCharset(const char *to_charset, const char *from_charset)
+{
+#if HAVE_ICONV
+ iconv_t cd = iconv_open(to_charset, from_charset);
+ if (cd == NULL)
+ return (0);
+ iconv_close(cd);
+ return (1);
+#else
+ return (0);
+#endif
+}
+
/*
* Sleep as needed; useful for verifying disk timestamp changes by
* ensuring that the wall-clock time has actually changed before we
/* Return true if this platform can run the "gunzip" program. */
int canGunzip(void);
+/* Return true if this patform can convert character-set. */
+int canConvertCharset(const char *, const char *);
+
/* Suck file into string allocated via malloc(). Call free() when done. */
/* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */
char *slurpfile(size_t *, const char *fmt, ...);
char buff[4096];
size_t used;
+ if (!canConvertCharset("UTF-8", "KOI8-R")) {
+ skipping("This system cannot convert character-set"
+ " from KOI8-R to UTF-8.");
+ return;
+ }
if (NULL == setlocale(LC_ALL, "ru_RU.KOI8-R")) {
skipping("KOI8-R locale not available on this system.");
return;
wchar_t ws[] = {0x8868, L'.', L't', L'x', L't', 0};
size_t used;
+ if (!canConvertCharset("UTF-8", "eucJP")) {
+ skipping("This system cannot convert character-set"
+ " from eucJP to UTF-8.");
+ return;
+ }
if (NULL == setlocale(LC_ALL, "ja_JP.eucJP")) {
skipping("eucJP locale not available on this system.");
return;
/*
* Read CAB filename in ja_JP.eucJP with "charset=CP932" option.
*/
+ if (!canConvertCharset("eucJP", "CP932")) {
+ skipping("This system cannot convert character-set"
+ " from CP932 to eucJP.");
+ return;
+ }
if (NULL == setlocale(LC_ALL, "ja_JP.eucJP")) {
skipping("ja_JP.eucJP locale not available on this system.");
return;
/*
* Read CAB filename in ja_JP.UTF-8 with "charset=CP932" option.
*/
+ if (!canConvertCharset("UTF-8", "CP932")) {
+ skipping("This system cannot convert character-set"
+ " from CP932 to UTF-8.");
+ return;
+ }
if (NULL == setlocale(LC_ALL, "ja_JP.UTF-8")) {
skipping("ja_JP.UTF-8 locale not available on this system.");
return;
/*
* Read LHA filename in ja_JP.eucJP.
*/
+ if (!canConvertCharset("eucJP", "CP932")) {
+ skipping("This system cannot convert character-set"
+ " from CP932 to eucJP.");
+ return;
+ }
if (NULL == setlocale(LC_ALL, "ja_JP.eucJP")) {
skipping("ja_JP.eucJP locale not available on this system.");
return;
/*
* Read LHA filename in ja_JP.UTF-8.
*/
+ if (!canConvertCharset("UTF-8", "CP932")) {
+ skipping("This system cannot convert character-set"
+ " from CP932 to UTF-8.");
+ return;
+ }
if (NULL == setlocale(LC_ALL, "ja_JP.UTF-8")) {
skipping("ja_JP.UTF-8 locale not available on this system.");
return;
/*
* Read ZIP filename in ja_JP.eucJP with "charset=CP932" option.
*/
+ if (!canConvertCharset("eucJP", "CP932")) {
+ skipping("This system cannot convert character-set"
+ " from CP932 to eucJP.");
+ return;
+ }
if (NULL == setlocale(LC_ALL, "ja_JP.eucJP")) {
skipping("ja_JP.eucJP locale not available on this system.");
return;
/*
* Read ZIP filename in ja_JP.UTF-8 with "charset=CP932" option.
*/
+ if (!canConvertCharset("UTF-8", "CP932")) {
+ skipping("This system cannot convert character-set"
+ " from CP932 to UTF-8.");
+ return;
+ }
if (NULL == setlocale(LC_ALL, "ja_JP.UTF-8")) {
skipping("ja_JP.UTF-8 locale not available on this system.");
return;