summaryrefslogtreecommitdiff
path: root/load.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-26 04:04:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-26 04:04:23 +0000
commit8948280c67072f652eebc31bc3a2f3fb86bcca5f (patch)
tree8e433b03c6bc0f19f1a166b53d8aea0430e24c97 /load.c
parent2c181b6d1a0514204e049e5f37529b8b8ccfe434 (diff)
load.c: search in OS path encoding
* load.c (rb_load_internal): use rb_load_file_str() to keep path encoding. * load.c (rb_require_safe): search in OS path encoding for Windows. * ruby.c (rb_load_file_str): load file with keeping path encoding. * win32/file.c (rb_file_load_ok): use WCHAR type API assuming incoming path is encoded in UTF-8. [ruby-core:56136] [Bug #8676] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'load.c')
-rw-r--r--load.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/load.c b/load.c
index 9d95c95fff..03ce062f14 100644
--- a/load.c
+++ b/load.c
@@ -591,7 +591,7 @@ rb_load_internal(VALUE fname, int wrap)
VALUE iseq;
th->mild_compile_error++;
- node = (NODE *)rb_load_file(RSTRING_PTR(fname));
+ node = (NODE *)rb_load_file_str(fname);
loaded = TRUE;
iseq = rb_iseq_new_top(node, rb_str_new2("<top (required)>"), fname, rb_realpath_internal(Qnil, fname, 1), Qfalse);
th->mild_compile_error--;
@@ -941,7 +941,8 @@ rb_require_safe(VALUE fname, int safe)
rb_sourceline());
}
- found = search_required(fname, &path, safe);
+ path = rb_str_encode_ospath(fname);
+ found = search_required(path, &path, safe);
if (RUBY_DTRACE_FIND_REQUIRE_RETURN_ENABLED()) {
RUBY_DTRACE_FIND_REQUIRE_RETURN(StringValuePtr(fname),