Index: parse.y =================================================================== --- parse.y (revision 42491) +++ parse.y (working copy) @@ -5450,13 +5450,13 @@ rb_compile_string(const char *f, VALUE s, int line) { must_be_ascii_compatible(s); - return parser_compile_string(rb_parser_new(), rb_filesystem_str_new_cstr(f), s, line); + return parser_compile_string(rb_parser_new(), rb_enc_str_new(f, strlen(f), rb_default_internal_encoding()), s, line); } NODE* rb_parser_compile_string(volatile VALUE vparser, const char *f, VALUE s, int line) { - return rb_parser_compile_string_path(vparser, rb_filesystem_str_new_cstr(f), s, line); + return rb_parser_compile_string_path(vparser, rb_enc_str_new(f, strlen(f), rb_default_internal_encoding()), s, line); } NODE* @@ -5470,14 +5470,14 @@ rb_compile_cstr(const char *f, const char *s, int len, int line) { VALUE str = rb_str_new(s, len); - return parser_compile_string(rb_parser_new(), rb_filesystem_str_new_cstr(f), str, line); + return parser_compile_string(rb_parser_new(), rb_enc_str_new(f, strlen(f), rb_default_internal_encoding()), str, line); } NODE* rb_parser_compile_cstr(volatile VALUE vparser, const char *f, const char *s, int len, int line) { VALUE str = rb_str_new(s, len); - return parser_compile_string(vparser, rb_filesystem_str_new_cstr(f), str, line); + return parser_compile_string(vparser, rb_enc_str_new(f, strlen(f), rb_default_internal_encoding()), str, line); } static VALUE @@ -5497,7 +5497,7 @@ NODE* rb_parser_compile_file(volatile VALUE vparser, const char *f, VALUE file, int start) { - return rb_parser_compile_file_path(vparser, rb_filesystem_str_new_cstr(f), file, start); + return rb_parser_compile_file_path(vparser, rb_enc_str_new(f, strlen(f), rb_default_internal_encoding()), file, start); } NODE* Index: ruby.c =================================================================== --- ruby.c (revision 42491) +++ ruby.c (working copy) @@ -1466,6 +1475,10 @@ th->parse_in_eval++; \ th->base_block = 0; \ } while (0) + + opt->script_name = rb_str_encode_ospath(opt->script_name); + opt->script = RSTRING_PTR(opt->script_name); + ruby_set_script_name(opt->script_name); if (opt->e_script) { VALUE progname = rb_progname;