* It is merely implied, but this should not be an error.
*/
int test_iconv_untranslatable() {
+ iconv_t cd;
+ const char* fromcode = "UTF-8";
+ const char* tocode = "ASCII";
+
+ printf("%-60s", "iconv() untranslatable input is not an error...");
+ if (_my_iconv_open(&cd, tocode, fromcode) == FAILURE) {
+ printf("ERROR (iconv_open)\n");
+ return FAILURE;
+ }
+
+ size_t insize = 2, outsize = 8;
+ char inbuf[2] = {0xC3, 0x96}; // ΓΌ
+ char outbuf[8] = {0};
+ char* inptr = inbuf;
+ char* outptr = outbuf;
+
+ size_t result = iconv(cd, &inptr, &insize, &outptr, &outsize);
+
+ if (result == (size_t)(-1)) {
+ int saved_errno = errno; // iconv_close() clobbers it
+
+ if (_my_iconv_close(&cd) == FAILURE) {
+ printf("ERROR (iconv_close)\n");
+ }
+ else {
+ printf("FAIL (%s)\n", ERRNO_STR(saved_errno));
+ }
+
+ return FAILURE;
+ }
+
+ printf("OK (outbuf=%s)\n", outbuf);
return SUCCESS;
}