summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ruby.c b/ruby.c
index 2ddea6b..c01d78e 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1819,6 +1819,9 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
Init_ruby_description();
Init_enc();
lenc = rb_locale_encoding();
+#if UTF8_PATH
+ uenc = rb_utf8_encoding();
+#endif
rb_enc_associate(rb_progname, lenc);
rb_obj_freeze(rb_progname);
parser = rb_parser_new();
@@ -1839,7 +1842,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
enc = rb_enc_from_index(opt->ext.enc.index);
}
else {
- enc = lenc;
+ enc = IF_UTF8_PATH(uenc, lenc);
}
rb_enc_set_default_external(rb_enc_from_encoding(enc));
if (opt->intern.enc.index >= 0) {
@@ -1944,7 +1947,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
enc = rb_enc_from_index(opt->ext.enc.index);
}
else {
- enc = lenc;
+ enc = IF_UTF8_PATH(uenc, lenc);
}
rb_enc_set_default_external(rb_enc_from_encoding(enc));
if (opt->intern.enc.index >= 0) {