summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2001-09-23 06:40:35 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2001-09-23 06:40:35 +0000
commit61170ee8403ead856956207fef048e6eae3563ed (patch)
treef3a7ed4ea39703eff77135fcaba5d60cf4d77a1c
parentf42a0e5af321a4a0e02c51127a1ee0b62c272ba4 (diff)
downloadtar-61170ee8403ead856956207fef048e6eae3563ed.tar.gz
Don't assume we're using the included libintl.
-rw-r--r--lib/unicodeio.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/unicodeio.c b/lib/unicodeio.c
index 4300df55..37b69aaa 100644
--- a/lib/unicodeio.c
+++ b/lib/unicodeio.c
@@ -48,6 +48,10 @@ extern int errno;
# include <iconv.h>
#endif
+#if HAVE_LANGINFO_CODESET && ! USE_INCLUDED_LIBINTL
+# include <langinfo.h>
+#endif
+
#include "unicodeio.h"
/* When we pass a Unicode character to iconv(), we must pass it in a
@@ -126,8 +130,18 @@ unicode_to_mb (unsigned int code,
if (!initialized)
{
+ const char *charset;
+
+#if USE_INCLUDED_LIBINTL
extern const char *locale_charset PARAMS ((void));
- const char *charset = locale_charset ();
+ charset = locale_charset ();
+#else
+# if HAVE_LANGINFO_CODESET
+ charset = nl_langinfo (CODESET);
+# else
+ charset = "";
+# endif
+#endif
is_utf8 = !strcmp (charset, UTF8_NAME);
#if HAVE_ICONV