New option -local_charset
This commit is contained in:
@ -5353,7 +5353,7 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
|
||||
{
|
||||
int is_default, no_defaults, i, ret, adr_mode, bin_path_in_use= 0, do_single;
|
||||
char *line, sfe[5 * SfileadrL + 80], mode[80], *form, *treatment;
|
||||
char *in_pt, *out_pt;
|
||||
char *in_pt, *out_pt, *nl_charset, *local_charset;
|
||||
static char channel_prefixes[4][4]= {".","R","I","M"};
|
||||
static char load_names[][20]= {"auto", "session", "track", "lba", "volid"};
|
||||
static int max_load_mode= 4;
|
||||
@ -5844,6 +5844,13 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
|
||||
if(!(is_default && no_defaults))
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
|
||||
Xorriso_get_local_charset(xorriso, &local_charset, 0);
|
||||
nl_charset= nl_langinfo(CODESET);
|
||||
is_default= (strcmp(local_charset, nl_charset) == 0);
|
||||
sprintf(line, "-local_charset %s\n", Text_shellsafe(local_charset, sfe, 0));
|
||||
if(!(is_default && no_defaults))
|
||||
Xorriso_status_result(xorriso, filter, fp, flag & 2);
|
||||
|
||||
is_default= (xorriso->out_charset == NULL && xorriso->in_charset == NULL);
|
||||
in_pt= "";
|
||||
if(xorriso->in_charset != NULL)
|
||||
@ -10844,21 +10851,29 @@ int Xorriso_option_cdx(struct XorrisO *xorriso, char *disk_path, int flag)
|
||||
/* Option -charset */
|
||||
/* @param flag bit0= set in_charset
|
||||
bit1= set out_charset
|
||||
bit2= set local_charset
|
||||
*/
|
||||
int Xorriso_option_charset(struct XorrisO *xorriso, char *name, int flag)
|
||||
{
|
||||
char *name_pt= NULL, sfe[5 * SfileadrL];
|
||||
int ret;
|
||||
char *name_pt= NULL, sfe[5 * SfileadrL], *local_charset;
|
||||
iconv_t iconv_ret= (iconv_t) -1;
|
||||
|
||||
if(name != NULL)
|
||||
if(name[0] != 0)
|
||||
name_pt= name;
|
||||
if(flag & 4) {
|
||||
ret= Xorriso_set_local_charset(xorriso, name_pt, 0);
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
}
|
||||
if(flag & 1) {
|
||||
if(name_pt != NULL) {
|
||||
iconv_ret= iconv_open(nl_langinfo(CODESET), name_pt);
|
||||
Xorriso_get_local_charset(xorriso, &local_charset, 0);
|
||||
iconv_ret= iconv_open(local_charset, name_pt);
|
||||
if(iconv_ret == (iconv_t) -1) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-%scharset: Cannot convert from charset %s",
|
||||
"-%scharset: Cannot convert from character set %s",
|
||||
flag & 2 ? "" : "in_", Text_shellsafe(name_pt, sfe, 0));
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",
|
||||
0);
|
||||
@ -10873,7 +10888,8 @@ int Xorriso_option_charset(struct XorrisO *xorriso, char *name, int flag)
|
||||
}
|
||||
if(flag & 2) {
|
||||
if(name_pt != NULL) {
|
||||
iconv_ret= iconv_open(nl_langinfo(CODESET), name_pt);
|
||||
Xorriso_get_local_charset(xorriso, &local_charset, 0);
|
||||
iconv_ret= iconv_open(local_charset, name_pt);
|
||||
if(iconv_ret == (iconv_t) -1) {
|
||||
sprintf(xorriso->info_text, "-%scharset: Cannot convert to charset %s",
|
||||
flag & 1 ? "" : "out_", Text_shellsafe(name_pt, sfe, 0));
|
||||
@ -10888,13 +10904,14 @@ int Xorriso_option_charset(struct XorrisO *xorriso, char *name, int flag)
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if(name_pt == NULL)
|
||||
name_pt= nl_langinfo(CODESET);
|
||||
sprintf(xorriso->info_text, "Character set for %sconversion is now: %s",
|
||||
(flag & 3) == 1 ? "input " : (flag & 3) == 2 ? "output " : "",
|
||||
Text_shellsafe(name_pt, sfe, 0));
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "NOTE", 0);
|
||||
if(flag & 3) {
|
||||
if(name_pt == NULL)
|
||||
Xorriso_get_local_charset(xorriso, &name_pt, 0);
|
||||
sprintf(xorriso->info_text, "Character set for %sconversion is now: %s",
|
||||
(flag & 3) == 1 ? "input " : (flag & 3) == 2 ? "output " : "",
|
||||
Text_shellsafe(name_pt, sfe, 0));
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
@ -12411,12 +12428,14 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
||||
" -rom_toc_scan \"on\"|\"off\"[:\"emul_on\"|\"emul_off\"]",
|
||||
" Enable scanning for ISO sessions on read-only drives/media",
|
||||
" resp. on overwriteable media with emulated TOC.",
|
||||
" -charset name Set the character set name to be use for file name",
|
||||
" -charset name Set the character set name to be used for file name",
|
||||
" conversion from and to media.",
|
||||
" -in_charset name",
|
||||
" Like -charset but only for conversion from media.",
|
||||
" -out_charset name",
|
||||
" Like -charset but only for conversion to media.",
|
||||
" -local_charset name",
|
||||
" Override system assumption of the local character set name.",
|
||||
" -ban_stdio_write",
|
||||
" Allow for writing only the usage of optical drives.",
|
||||
" -blank \"fast\"|\"all\"|\"deformat\"|\"deformat_quickest\"",
|
||||
@ -14815,7 +14834,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
|
||||
"cd","cdi","cdx","charset","close","commit_eject",
|
||||
"dev", "dummy","dialog","disk_pattern","eject","iso_rr_pattern","follow",
|
||||
"format","fs","gid","grow_blindly",
|
||||
"history","indev","in_charset","joliet","list_delimiter",
|
||||
"history","indev","in_charset","joliet","list_delimiter","local_charset",
|
||||
"mark","not_leaf","not_list","not_mgt",
|
||||
"options_from_file","osirrox","outdev","out_charset","overwrite",
|
||||
"pacifier","padding","path_list","pathspecs","pkt_output","print","prompt",
|
||||
@ -15223,6 +15242,10 @@ next_command:;
|
||||
(*idx)+= 2;
|
||||
ret= Xorriso_option_load(xorriso, arg1, arg2, 0);
|
||||
|
||||
} else if(strcmp(cmd,"local_charset")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_charset(xorriso, arg1, 4);
|
||||
|
||||
} else if(strcmp(cmd,"logfile")==0) {
|
||||
(*idx)+= 2;
|
||||
ret= Xorriso_option_logfile(xorriso, arg1, arg2, 0);
|
||||
|
Reference in New Issue
Block a user