New option -local_charset
This commit is contained in:
parent
de05652cf1
commit
22dc07ce9a
@ -2,7 +2,7 @@
|
|||||||
.\" First parameter, NAME, should be all caps
|
.\" First parameter, NAME, should be all caps
|
||||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||||
.\" other parameters are allowed: see man(7), man(1)
|
.\" other parameters are allowed: see man(7), man(1)
|
||||||
.TH XORRISO 1 "Oct 25, 2008"
|
.TH XORRISO 1 "Nov 07, 2008"
|
||||||
.\" Please adjust this date whenever revising the manpage.
|
.\" Please adjust this date whenever revising the manpage.
|
||||||
.\"
|
.\"
|
||||||
.\" Some roff macros, for reference:
|
.\" Some roff macros, for reference:
|
||||||
@ -1513,9 +1513,9 @@ The meanings of byte codes are defined in \fBcharacter sets\fR which have
|
|||||||
names. Shell command iconv -l lists them.
|
names. Shell command iconv -l lists them.
|
||||||
.br
|
.br
|
||||||
Character sets should not matter as long as only alphanumeric characters are
|
Character sets should not matter as long as only alphanumeric characters are
|
||||||
used for file names or as long as the computer which runs xorriso uses the
|
used for file names or as long as the shell session which runs xorriso uses the
|
||||||
same character set as the computer which wrote the loaded image and those
|
same character set as the one which wrote the loaded image and the same
|
||||||
computers which shall read the newly emerging ISO image.
|
character set as the computers which shall read the newly emerging ISO image.
|
||||||
Outside these constraints it may be necessary to let xorriso convert byte
|
Outside these constraints it may be necessary to let xorriso convert byte
|
||||||
codes.
|
codes.
|
||||||
.br
|
.br
|
||||||
@ -1525,13 +1525,23 @@ character set to the output character set is performed when a new
|
|||||||
image tree gets written. The sets can be defined independently by options
|
image tree gets written. The sets can be defined independently by options
|
||||||
-in_charset and -out_charset. Normally one will have both identical, if ever.
|
-in_charset and -out_charset. Normally one will have both identical, if ever.
|
||||||
.br
|
.br
|
||||||
xorriso expects and uses the local character set for command arguments
|
If conversions are desired then it is necessary to know the name of the
|
||||||
and file name output. Other character sets will only be in effect on media.
|
local character set. xorriso can inquire the same info as shell command
|
||||||
|
"locale" with argument "charmap". This may or may not be the correct name.
|
||||||
|
So one should check.
|
||||||
|
.br
|
||||||
|
A typical wrong answer would be "ANSI_X3.4-1968" if your shell session supports
|
||||||
|
non-US-ASCII characters.
|
||||||
|
It is outside the scope of xorriso how to find out the correct name in such
|
||||||
|
a case. The author of this text uses -local_charset "ISO-8859-1".
|
||||||
.TP
|
.TP
|
||||||
\fB\-charset\fR character_set_name
|
\fB\-charset\fR character_set_name
|
||||||
Set the character set from which to convert file names when loading an
|
Set the character set from which to convert file names when loading an
|
||||||
image and to which to convert when writing an image.
|
image and to which to convert when writing an image.
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-local_charset\fR character_set_name
|
||||||
|
Override the system assumption of the local character set name.
|
||||||
|
.TP
|
||||||
.B Exception processing:
|
.B Exception processing:
|
||||||
.PP
|
.PP
|
||||||
Since the tasks of xorriso are manifold and prone to external influence, there
|
Since the tasks of xorriso are manifold and prone to external influence, there
|
||||||
|
@ -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;
|
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 *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 channel_prefixes[4][4]= {".","R","I","M"};
|
||||||
static char load_names[][20]= {"auto", "session", "track", "lba", "volid"};
|
static char load_names[][20]= {"auto", "session", "track", "lba", "volid"};
|
||||||
static int max_load_mode= 4;
|
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))
|
if(!(is_default && no_defaults))
|
||||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
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);
|
is_default= (xorriso->out_charset == NULL && xorriso->in_charset == NULL);
|
||||||
in_pt= "";
|
in_pt= "";
|
||||||
if(xorriso->in_charset != NULL)
|
if(xorriso->in_charset != NULL)
|
||||||
@ -10844,21 +10851,29 @@ int Xorriso_option_cdx(struct XorrisO *xorriso, char *disk_path, int flag)
|
|||||||
/* Option -charset */
|
/* Option -charset */
|
||||||
/* @param flag bit0= set in_charset
|
/* @param flag bit0= set in_charset
|
||||||
bit1= set out_charset
|
bit1= set out_charset
|
||||||
|
bit2= set local_charset
|
||||||
*/
|
*/
|
||||||
int Xorriso_option_charset(struct XorrisO *xorriso, char *name, int flag)
|
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;
|
iconv_t iconv_ret= (iconv_t) -1;
|
||||||
|
|
||||||
if(name != NULL)
|
if(name != NULL)
|
||||||
if(name[0] != 0)
|
if(name[0] != 0)
|
||||||
name_pt= name;
|
name_pt= name;
|
||||||
|
if(flag & 4) {
|
||||||
|
ret= Xorriso_set_local_charset(xorriso, name_pt, 0);
|
||||||
|
if(ret <= 0)
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
if(flag & 1) {
|
if(flag & 1) {
|
||||||
if(name_pt != NULL) {
|
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) {
|
if(iconv_ret == (iconv_t) -1) {
|
||||||
sprintf(xorriso->info_text,
|
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));
|
flag & 2 ? "" : "in_", Text_shellsafe(name_pt, sfe, 0));
|
||||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",
|
||||||
0);
|
0);
|
||||||
@ -10873,7 +10888,8 @@ int Xorriso_option_charset(struct XorrisO *xorriso, char *name, int flag)
|
|||||||
}
|
}
|
||||||
if(flag & 2) {
|
if(flag & 2) {
|
||||||
if(name_pt != NULL) {
|
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) {
|
if(iconv_ret == (iconv_t) -1) {
|
||||||
sprintf(xorriso->info_text, "-%scharset: Cannot convert to charset %s",
|
sprintf(xorriso->info_text, "-%scharset: Cannot convert to charset %s",
|
||||||
flag & 1 ? "" : "out_", Text_shellsafe(name_pt, sfe, 0));
|
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);
|
return(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(flag & 3) {
|
||||||
if(name_pt == NULL)
|
if(name_pt == NULL)
|
||||||
name_pt= nl_langinfo(CODESET);
|
Xorriso_get_local_charset(xorriso, &name_pt, 0);
|
||||||
sprintf(xorriso->info_text, "Character set for %sconversion is now: %s",
|
sprintf(xorriso->info_text, "Character set for %sconversion is now: %s",
|
||||||
(flag & 3) == 1 ? "input " : (flag & 3) == 2 ? "output " : "",
|
(flag & 3) == 1 ? "input " : (flag & 3) == 2 ? "output " : "",
|
||||||
Text_shellsafe(name_pt, sfe, 0));
|
Text_shellsafe(name_pt, sfe, 0));
|
||||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "NOTE", 0);
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||||
|
}
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12411,12 +12428,14 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
|||||||
" -rom_toc_scan \"on\"|\"off\"[:\"emul_on\"|\"emul_off\"]",
|
" -rom_toc_scan \"on\"|\"off\"[:\"emul_on\"|\"emul_off\"]",
|
||||||
" Enable scanning for ISO sessions on read-only drives/media",
|
" Enable scanning for ISO sessions on read-only drives/media",
|
||||||
" resp. on overwriteable media with emulated TOC.",
|
" 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.",
|
" conversion from and to media.",
|
||||||
" -in_charset name",
|
" -in_charset name",
|
||||||
" Like -charset but only for conversion from media.",
|
" Like -charset but only for conversion from media.",
|
||||||
" -out_charset name",
|
" -out_charset name",
|
||||||
" Like -charset but only for conversion to media.",
|
" Like -charset but only for conversion to media.",
|
||||||
|
" -local_charset name",
|
||||||
|
" Override system assumption of the local character set name.",
|
||||||
" -ban_stdio_write",
|
" -ban_stdio_write",
|
||||||
" Allow for writing only the usage of optical drives.",
|
" Allow for writing only the usage of optical drives.",
|
||||||
" -blank \"fast\"|\"all\"|\"deformat\"|\"deformat_quickest\"",
|
" -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",
|
"cd","cdi","cdx","charset","close","commit_eject",
|
||||||
"dev", "dummy","dialog","disk_pattern","eject","iso_rr_pattern","follow",
|
"dev", "dummy","dialog","disk_pattern","eject","iso_rr_pattern","follow",
|
||||||
"format","fs","gid","grow_blindly",
|
"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",
|
"mark","not_leaf","not_list","not_mgt",
|
||||||
"options_from_file","osirrox","outdev","out_charset","overwrite",
|
"options_from_file","osirrox","outdev","out_charset","overwrite",
|
||||||
"pacifier","padding","path_list","pathspecs","pkt_output","print","prompt",
|
"pacifier","padding","path_list","pathspecs","pkt_output","print","prompt",
|
||||||
@ -15223,6 +15242,10 @@ next_command:;
|
|||||||
(*idx)+= 2;
|
(*idx)+= 2;
|
||||||
ret= Xorriso_option_load(xorriso, arg1, arg2, 0);
|
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) {
|
} else if(strcmp(cmd,"logfile")==0) {
|
||||||
(*idx)+= 2;
|
(*idx)+= 2;
|
||||||
ret= Xorriso_option_logfile(xorriso, arg1, arg2, 0);
|
ret= Xorriso_option_logfile(xorriso, arg1, arg2, 0);
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2008.11.04.162214"
|
#define Xorriso_timestamP "2008.11.06.183736"
|
||||||
|
@ -21,6 +21,9 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
|
|
||||||
|
/* for -charset */
|
||||||
|
#include <iconv.h>
|
||||||
|
#include <langinfo.h>
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
@ -3855,6 +3858,7 @@ int Xorriso_toc_line(struct XorrisO *xorriso, int flag)
|
|||||||
|
|
||||||
|
|
||||||
/* @param flag bit0= no output if no boot record was found
|
/* @param flag bit0= no output if no boot record was found
|
||||||
|
bit1= short form
|
||||||
bit3= report to info channel (else to result channel)
|
bit3= report to info channel (else to result channel)
|
||||||
*/
|
*/
|
||||||
int Xorriso_show_boot_info(struct XorrisO *xorriso, int flag)
|
int Xorriso_show_boot_info(struct XorrisO *xorriso, int flag)
|
||||||
@ -3932,6 +3936,8 @@ no_boot:;
|
|||||||
}
|
}
|
||||||
strcat(respt, "\n");
|
strcat(respt, "\n");
|
||||||
Xorriso_toc_line(xorriso, flag & 8);
|
Xorriso_toc_line(xorriso, flag & 8);
|
||||||
|
if(flag & 2)
|
||||||
|
return(1);
|
||||||
if(bin_path_valid)
|
if(bin_path_valid)
|
||||||
sprintf(respt, "Boot bin_path: %s\n", Text_shellsafe(path, sfe, 0));
|
sprintf(respt, "Boot bin_path: %s\n", Text_shellsafe(path, sfe, 0));
|
||||||
else if(xorriso->loaded_boot_bin_lba <= 0)
|
else if(xorriso->loaded_boot_bin_lba <= 0)
|
||||||
@ -4043,7 +4049,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
return(1);
|
return(1);
|
||||||
|
|
||||||
if(!(flag & 2))
|
if(!(flag & 2))
|
||||||
Xorriso_show_boot_info(xorriso, 1 | (flag & 8));
|
Xorriso_show_boot_info(xorriso, 1 | (flag & 8) | ((flag & 1) << 1));
|
||||||
|
|
||||||
disc= isoburn_toc_drive_get_disc(drive);
|
disc= isoburn_toc_drive_get_disc(drive);
|
||||||
if(flag & 4)
|
if(flag & 4)
|
||||||
@ -8126,3 +8132,43 @@ int Xorriso_extract_cut(struct XorrisO *xorriso,
|
|||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Xorriso_get_local_charset(struct XorrisO *xorriso, char **name, int flag)
|
||||||
|
{
|
||||||
|
(*name)= iso_get_local_charset(0);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Xorriso_set_local_charset(struct XorrisO *xorriso, char *name, int flag)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
char *nl_charset, sfe[5 * SfileadrL];
|
||||||
|
iconv_t iconv_ret= (iconv_t) -1;
|
||||||
|
|
||||||
|
nl_charset= nl_langinfo(CODESET);
|
||||||
|
if(name == NULL)
|
||||||
|
name= nl_charset;
|
||||||
|
|
||||||
|
if(name != NULL) {
|
||||||
|
iconv_ret= iconv_open(nl_charset, name);
|
||||||
|
if(iconv_ret == (iconv_t) -1)
|
||||||
|
goto cannot;
|
||||||
|
else
|
||||||
|
iconv_close(iconv_ret);
|
||||||
|
}
|
||||||
|
ret= iso_set_local_charset(name, 0);
|
||||||
|
if(ret <= 0) {
|
||||||
|
cannot:;
|
||||||
|
sprintf(xorriso->info_text,
|
||||||
|
"-local_charset: Cannot assume as local character set: %s",
|
||||||
|
Text_shellsafe(name, sfe, 0));
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
sprintf(xorriso->info_text, "Local character set is now assumed as: %s",
|
||||||
|
Text_shellsafe(name, sfe, 0));
|
||||||
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "NOTE", 0);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -300,6 +300,11 @@ int Xorriso_update_iso_lba0(struct XorrisO *xorriso, int iso_lba, int isosize,
|
|||||||
char *head_buffer, struct CheckmediajoB *job,
|
char *head_buffer, struct CheckmediajoB *job,
|
||||||
int flag);
|
int flag);
|
||||||
|
|
||||||
|
int Xorriso_get_local_charset(struct XorrisO *xorriso, char **name, int flag);
|
||||||
|
|
||||||
|
int Xorriso_set_local_charset(struct XorrisO *xorriso, char *name, int flag);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct CheckmediajoB {
|
struct CheckmediajoB {
|
||||||
int use_dev; /* 0= use indev , 1= use outdev , 2= use sector map*/
|
int use_dev; /* 0= use indev , 1= use outdev , 2= use sector map*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user