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;
a = archive_write_new();
assertEqualInt(ARCHIVE_OK, archive_write_set_format_pax(a));
+ if (archive_write_set_options(a, "charset=UTF-8") != ARCHIVE_OK) {
+ skipping("This system cannot convert character-set"
+ " from KOI8-R to UTF-8.");
+ archive_write_free(a);
+ return;
+ }
assertEqualInt(ARCHIVE_OK, archive_write_open_memory(a, buff, sizeof(buff), &used));
entry = archive_entry_new2(a);
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;
a = archive_write_new();
assertEqualInt(ARCHIVE_OK, archive_write_set_format_pax(a));
+ if (archive_write_set_options(a, "charset=UTF-8") != ARCHIVE_OK) {
+ skipping("This system cannot convert character-set"
+ " from eucJP to UTF-8.");
+ archive_write_free(a);
+ return;
+ }
assertEqualInt(ARCHIVE_OK, archive_write_open_memory(a, buff, sizeof(buff), &used));
entry = archive_entry_new2(a);