Index: include/ruby/intern.h =================================================================== --- include/ruby/intern.h (revision 42140) +++ include/ruby/intern.h (working copy) @@ -650,7 +650,7 @@ #define rb_argv rb_get_argv() RUBY_EXTERN VALUE rb_argv0; VALUE rb_get_argv(void); -void *rb_load_file(const char*); +void *rb_load_file(VALUE); /* signal.c */ VALUE rb_f_kill(int, VALUE*); #ifdef POSIX_SIGNAL Index: load.c =================================================================== --- load.c (revision 42140) +++ load.c (working copy) @@ -592,7 +592,7 @@ VALUE iseq; th->mild_compile_error++; - node = (NODE *)rb_load_file(RSTRING_PTR(fname)); + node = (NODE *)rb_load_file(fname); loaded = TRUE; iseq = rb_iseq_new_top(node, rb_str_new2(""), fname, rb_realpath_internal(Qnil, fname, 1), Qfalse); th->mild_compile_error--; Index: ruby.c =================================================================== --- ruby.c (revision 42140) +++ ruby.c (working copy) @@ -1748,12 +1748,11 @@ } void * -rb_load_file(const char *fname) +rb_load_file(VALUE fname) { struct cmdline_options opt; - VALUE fname_v = rb_str_new_cstr(fname); - return load_file(rb_parser_new(), fname_v, 0, cmdline_options_init(&opt)); + return load_file(rb_parser_new(), fname, 0, cmdline_options_init(&opt)); } static void Index: win32/file.c =================================================================== --- win32/file.c (revision 42140) +++ win32/file.c (working copy) @@ -686,13 +686,20 @@ rb_file_load_ok(const char *path) { int ret = 1; - DWORD attr = GetFileAttributes(path); + size_t len; + wchar_t* wpath; + + len = MultiByteToWideChar(CP_UTF8, 0, path, -1, NULL, 0) + 1; + wpath = (wchar_t *)xmalloc(len * sizeof(wchar_t)); + MultiByteToWideChar(CP_UTF8, 0, path, -1, wpath, len); + + DWORD attr = GetFileAttributesW(wpath); if (attr == INVALID_FILE_ATTRIBUTES || attr & FILE_ATTRIBUTE_DIRECTORY) { ret = 0; } else { - HANDLE h = CreateFile(path, GENERIC_READ, + HANDLE h = CreateFileW(wpath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (h != INVALID_HANDLE_VALUE) { @@ -702,6 +709,7 @@ ret = 0; } } + xfree(wpath); return ret; }