ruby.c: translit_char_bin
* ruby.c (translit_char_bin): should not use code page dependent CharNext on UTF-8 string. [ruby-dev:48752] [Bug #10555] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
11e75ca5e5
commit
b4c3c3171f
@ -1,3 +1,8 @@
|
||||
Sun Nov 30 00:02:22 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ruby.c (translit_char_bin): should not use code page dependent
|
||||
CharNext on UTF-8 string. [ruby-dev:48752] [Bug #10555]
|
||||
|
||||
Sat Nov 29 16:53:14 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ruby.c (ruby_set_argv): convert argv from UTF-8.
|
||||
|
15
ruby.c
15
ruby.c
@ -329,6 +329,16 @@ rb_libruby_handle(void)
|
||||
return libruby;
|
||||
}
|
||||
|
||||
static inline void
|
||||
translit_char_bin(char *p, int from, int to)
|
||||
{
|
||||
while (*p) {
|
||||
if ((unsigned char)*p == from)
|
||||
*p = to;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
# define UTF8_PATH 1
|
||||
#endif
|
||||
|
||||
@ -1338,7 +1348,10 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
|
||||
|
||||
opt->script_name = rb_str_new_cstr(opt->script);
|
||||
opt->script = RSTRING_PTR(opt->script_name);
|
||||
#if defined DOSISH || defined __CYGWIN__
|
||||
|
||||
#if _WIN32
|
||||
translit_char_bin(RSTRING_PTR(opt->script_name), '\\', '/');
|
||||
#elif defined DOSISH
|
||||
translit_char(RSTRING_PTR(opt->script_name), '\\', '/');
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user