summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utf8.c13
-rw-r--r--utf8.h5
2 files changed, 15 insertions, 3 deletions
diff --git a/utf8.c b/utf8.c
index 28e6d76a42..85fa2cd03f 100644
--- a/utf8.c
+++ b/utf8.c
@@ -521,6 +521,19 @@ char *reencode_string_len(const char *in, int insz,
iconv_close(conv);
return out;
}
+#else
+static int noiconv_warning_shown = 0;
+
+char *reencode_string_len(const char *in, int insz,
+ const char *out_encoding, const char *in_encoding,
+ int *outsz)
+{
+ if (!same_encoding(in_encoding, out_encoding) && !noiconv_warning_shown) {
+ warning("Iconv support is disabled at compile time. It is likely that\nincorrect data will be printed or stored in repository.\nConsider using other build for this task.");
+ noiconv_warning_shown = 1;
+ }
+ return NULL;
+}
#endif
/*
diff --git a/utf8.h b/utf8.h
index e7b2aa4168..c72998b152 100644
--- a/utf8.h
+++ b/utf8.h
@@ -26,13 +26,12 @@ void strbuf_utf8_replace(struct strbuf *sb, int pos, int width,
#ifndef NO_ICONV
char *reencode_string_iconv(const char *in, size_t insz,
iconv_t conv, int *outsz);
+#endif
+
char *reencode_string_len(const char *in, int insz,
const char *out_encoding,
const char *in_encoding,
int *outsz);
-#else
-#define reencode_string_len(a,b,c,d,e) NULL
-#endif
static inline char *reencode_string(const char *in,
const char *out_encoding,