Set encoding index correctly
This commit is contained in:
parent
b5646124b3
commit
f93c27d86b
Notes:
git
2024-08-28 12:48:01 +00:00
14
ruby.c
14
ruby.c
@ -2121,13 +2121,25 @@ prism_script_shebang_callback(pm_options_t *options, const uint8_t *source, size
|
|||||||
memcpy(switches, source, length);
|
memcpy(switches, source, length);
|
||||||
switches[length] = '\0';
|
switches[length] = '\0';
|
||||||
|
|
||||||
|
int no_src_enc = !opt->src.enc.name;
|
||||||
|
int no_ext_enc = !opt->ext.enc.name;
|
||||||
|
int no_int_enc = !opt->intern.enc.name;
|
||||||
|
|
||||||
moreswitches(switches, opt, 0);
|
moreswitches(switches, opt, 0);
|
||||||
free(switches);
|
free(switches);
|
||||||
|
|
||||||
pm_options_command_line_set(options, prism_script_command_line(opt));
|
pm_options_command_line_set(options, prism_script_command_line(opt));
|
||||||
if (opt->ext.enc.name != 0) {
|
|
||||||
|
if (no_src_enc && opt->src.enc.name) {
|
||||||
|
opt->src.enc.index = opt_enc_index(opt->src.enc.name);
|
||||||
pm_options_encoding_set(options, StringValueCStr(opt->ext.enc.name));
|
pm_options_encoding_set(options, StringValueCStr(opt->ext.enc.name));
|
||||||
}
|
}
|
||||||
|
if (no_ext_enc && opt->ext.enc.name) {
|
||||||
|
opt->ext.enc.index = opt_enc_index(opt->ext.enc.name);
|
||||||
|
}
|
||||||
|
if (no_int_enc && opt->intern.enc.name) {
|
||||||
|
opt->intern.enc.index = opt_enc_index(opt->intern.enc.name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user