summaryrefslogtreecommitdiffstats
path: root/encoding.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-21 03:03:29 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-21 03:03:29 +0000
commite8efd91a224204d0ead82f576404d5fb4d8a4f87 (patch)
tree8bdb4255302bf981ff02b49030671e4ec87fc031 /encoding.c
parentcafcb04d8f7df2ec571e4d7faf337ba37ae36609 (diff)
downloadruby-e8efd91a224204d0ead82f576404d5fb4d8a4f87.tar.gz
ruby-e8efd91a224204d0ead82f576404d5fb4d8a4f87.tar.xz
ruby-e8efd91a224204d0ead82f576404d5fb4d8a4f87.zip
* configure.in: check langinfo.h and locale.h.
* encoding.c: use langinfo.h only if available. * main.c: use locale.h only if available. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 1e130162b..07c9b42e9 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