aboutsummaryrefslogtreecommitdiffstats
path: root/encoding.c
diff options
context:
space:
mode:
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/encoding.c b/encoding.c
index 1e130162be..07c9b42e9d 100644
--- a/encoding.c
+++ b/encoding.c
@@ -14,7 +14,9 @@
#include "ruby/encoding.h"
#include "regenc.h"
#include <ctype.h>
+#ifdef HAVE_LANGINFO_H
#include <langinfo.h>
+#endif
static ID id_encoding, id_based_encoding;
static VALUE rb_cEncoding;
@@ -707,9 +709,13 @@ rb_enc_set_default_external(VALUE encoding)
VALUE
rb_locale_charmap(VALUE klass)
{
+#ifdef HAVE_LANGINFO_H
char *codeset;
codeset = nl_langinfo(CODESET);
return rb_str_new2(codeset);
+#else
+ return rb_str_new2("ASCII-8BIT");
+#endif
}
static void