summaryrefslogtreecommitdiffstats
path: root/ruby.c
diff options
context:
space:
mode:
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ruby.c b/ruby.c
index f16ed424c..525a3cdb1 100644
--- a/ruby.c
+++ b/ruby.c
@@ -139,9 +139,12 @@ static rb_encoding *
locale_encoding(void)
{
VALUE codeset = rb_locale_charmap(Qnil);
- char *name = StringValueCStr(codeset);
+ char *name;
int idx;
+ if (codeset == Qnil)
+ return rb_default_encoding();
+
idx = rb_enc_find_index(name);
if (idx < 0)
return rb_default_encoding();