New options -charset, -in_charset, -out_charset
This commit is contained in:
parent
cf920a350d
commit
8286998e04
@ -65,6 +65,7 @@ then
|
||||
-e 's/<b>Settings for result writing:<\/b>/\ <BR><b>Settings for result writing:<\/b><BR>\ <BR>/' \
|
||||
-e 's/^706k = 706kB/\ \ 706k = 706kB/' \
|
||||
-e 's/^5540k = 5540kB/\ \ 5540k = 5540kB/' \
|
||||
-e 's/<b>Character sets:<\/b>/\ <BR><b>Character sets:<\/b><BR>\ <BR>/' \
|
||||
-e 's/<b>Exception processing:<\/b>/\ <BR><b>Exception processing:<\/b><BR>\ <BR>/' \
|
||||
-e 's/<b>El Torito bootable ISO images:<\/b>/\ <BR><b>El Torito bootable ISO images:<\/b><BR>\ <BR>/' \
|
||||
-e 's/<b>Dialog mode control:<\/b>/\ <BR><b>Dialog mode control:<\/b><BR>\ <BR>/' \
|
||||
|
@ -555,6 +555,11 @@ until the next -dev or -indev. After the image has been loaded once, the
|
||||
setting is valid for -rollback until next -dev or -indev, where it
|
||||
will be reset to "auto".
|
||||
.TP
|
||||
\fB\-in_charset\fR character_set_name
|
||||
Set the character set from which to convert file names when loading an
|
||||
image. This has eventually to be done before specifying -dev , -indev or
|
||||
-rollback. See paragraph "Character sets" for more explanations.
|
||||
.TP
|
||||
\fB\-rom_toc_scan\fR "on"|"off"[:"emul_on"|"emul_off"]
|
||||
Read-only drives do not tell the actual media type but show any media as
|
||||
ROM (e.g. as DVD-ROM). The session history of MMC multi-session media might
|
||||
@ -1328,7 +1333,7 @@ If enabled by "on", generate Joliet info additional to Rock Ridge info.
|
||||
Specify the volume ID. xorriso accepts any text up to 32 characters,
|
||||
but according to rarely obeyed specs stricter rules apply:
|
||||
.br
|
||||
ECMA 119 demands character set [A-Z0-9_]. Like: "IMAGE_23"
|
||||
ECMA 119 demands ASCII characters out of [A-Z0-9_]. Like: "IMAGE_23"
|
||||
.br
|
||||
Joliet allows 16 UCS-2 characters. Like: "Windows name"
|
||||
.br
|
||||
@ -1348,6 +1353,10 @@ If you insist in -volid "ISOIMAGE", set it again after those commands.
|
||||
Set the publisher string to be written with the next -commit. Permissible
|
||||
are up to 128 characters.
|
||||
.TP
|
||||
\fB\-out_charset\fR character_set_name
|
||||
Set the character set to which file names get converted when writing an
|
||||
image. See paragraph "Character sets" for more explanations.
|
||||
.TP
|
||||
\fB\-uid\fR uid
|
||||
User id to be used for all files when the new ISO tree gets written to media.
|
||||
.TP
|
||||
@ -1454,7 +1463,7 @@ boot image which is present on the input media.
|
||||
Most safe is the default: -boot_image "any" "discard".
|
||||
.br
|
||||
|
||||
A bootspec is a word of the form name=value and is used describe the
|
||||
A bootspec is a word of the form name=value and is used to describe the
|
||||
activation of a ISOLINUX boot image by an El Torito record and eventually
|
||||
a MBR. The names "dir" and "bin_path" lead to boot image activation.
|
||||
.br
|
||||
@ -1491,6 +1500,34 @@ write session if not the isohybrid signature is found in the bin_path file.
|
||||
Default is "isohybrid=auto" which silently omits the MBR if the signature is
|
||||
missing.
|
||||
.TP
|
||||
.B Character sets:
|
||||
.PP
|
||||
File names are strings of non-zero bytes with 8 bit each. Unfortunately
|
||||
the same byte string may appear as different peculiar national characters
|
||||
on differently nationalized computers.
|
||||
The meanings of byte codes are defined in \fBcharacter sets\fR which have
|
||||
names. Shell command iconv -l lists them.
|
||||
.br
|
||||
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
|
||||
same character set as the computer which wrote the loaded image and those
|
||||
computers which shall read the newly emerging ISO image.
|
||||
Outside these constraints it may be necessary to let xorriso convert byte
|
||||
codes.
|
||||
.br
|
||||
There is an input conversion from input character set to the local character
|
||||
set which applies when an ISO image gets loaded. A conversion from local
|
||||
character set to the output character set is performed when a new
|
||||
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.
|
||||
.br
|
||||
xorriso expects and uses the local character set for command arguments
|
||||
and file name output. Other character sets will only be in effect on media.
|
||||
.TP
|
||||
\fB\-charset\fR character_set_name
|
||||
Set the character set from which to convert file names when loading an
|
||||
image and to which to convert when writing an image.
|
||||
.TP
|
||||
.B Exception processing:
|
||||
.PP
|
||||
Since the tasks of xorriso are manifold and prone to external influence, there
|
||||
|
@ -90,6 +90,10 @@ or
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
|
||||
/* for -charset */
|
||||
#include <iconv.h>
|
||||
#include <langinfo.h>
|
||||
|
||||
/* eventually, this is done in xorriso_private.h : #include <regex.h> */
|
||||
|
||||
#ifdef Xorriso_with_readlinE
|
||||
@ -3659,12 +3663,14 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
||||
m->indev[0]= 0;
|
||||
m->in_drive_handle= NULL;
|
||||
m->in_volset_handle= NULL;
|
||||
m->in_charset= NULL;
|
||||
m->volset_change_pending= 0;
|
||||
m->no_volset_present= 0;
|
||||
m->in_sector_map= NULL;
|
||||
m->check_media_default= NULL;
|
||||
m->outdev[0]= 0;
|
||||
m->out_drive_handle= NULL;
|
||||
m->out_charset= NULL;
|
||||
m->dev_fd_1= -1;
|
||||
m->grow_blindly_msc2= -1;
|
||||
m->ban_stdio_write= 0;
|
||||
@ -3827,6 +3833,10 @@ int Xorriso_destroy(struct XorrisO **xorriso, int flag)
|
||||
m= *xorriso;
|
||||
if(m==NULL)
|
||||
return(0);
|
||||
if(m->in_charset!=NULL)
|
||||
free(m->in_charset);
|
||||
if(m->out_charset!=NULL)
|
||||
free(m->out_charset);
|
||||
Xorriso_destroy_re(m,0);
|
||||
Exclusions_destroy(&(m->disk_exclusions), 0);
|
||||
Xorriso_detach_libraries(m, flag&1);
|
||||
@ -5342,6 +5352,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;
|
||||
char *line, sfe[5 * SfileadrL + 80], mode[80], *form, *treatment;
|
||||
char *in_pt, *out_pt;
|
||||
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;
|
||||
@ -5826,7 +5837,28 @@ 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);
|
||||
|
||||
if(strcmp(xorriso->indev,xorriso->outdev)==0) {
|
||||
is_default= (xorriso->out_charset == NULL && xorriso->in_charset == NULL);
|
||||
in_pt= "";
|
||||
if(xorriso->in_charset != NULL)
|
||||
in_pt= xorriso->in_charset;
|
||||
out_pt= "";
|
||||
if(xorriso->out_charset != NULL)
|
||||
out_pt= xorriso->out_charset;
|
||||
if(strcmp(in_pt, out_pt) == 0 &&
|
||||
strncmp(filter, "-in_charset", 11) != 0 &&
|
||||
strncmp(filter, "-out_charset", 12) != 0) {
|
||||
sprintf(line, "-charset %s\n", Text_shellsafe(in_pt, sfe, 0));
|
||||
Xorriso_status_result(xorriso, filter, fp, flag & 2);
|
||||
} else {
|
||||
sprintf(line, "-in_charset %s\n", Text_shellsafe(in_pt, sfe, 0));
|
||||
Xorriso_status_result(xorriso, filter, fp, flag & 2);
|
||||
sprintf(line, "-out_charset %s\n", Text_shellsafe(out_pt, sfe, 0));
|
||||
Xorriso_status_result(xorriso, filter, fp, flag & 2);
|
||||
}
|
||||
|
||||
if(strcmp(xorriso->indev, xorriso->outdev) == 0 &&
|
||||
strncmp(filter, "-indev", 6) != 0 &&
|
||||
strncmp(filter, "-outdev", 7) != 0) {
|
||||
sprintf(line,"-dev %s\n", Text_shellsafe(xorriso->indev,sfe,0));
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
} else {
|
||||
@ -10771,6 +10803,64 @@ int Xorriso_option_cdx(struct XorrisO *xorriso, char *disk_path, int flag)
|
||||
}
|
||||
|
||||
|
||||
/* Option -charset */
|
||||
/* @param flag bit0= set in_charset
|
||||
bit1= set out_charset
|
||||
*/
|
||||
int Xorriso_option_charset(struct XorrisO *xorriso, char *name, int flag)
|
||||
{
|
||||
char *name_pt= NULL, sfe[5 * SfileadrL];
|
||||
iconv_t iconv_ret= (iconv_t) -1;
|
||||
|
||||
if(name != NULL)
|
||||
if(name[0] != 0)
|
||||
name_pt= name;
|
||||
if(flag & 1) {
|
||||
if(name_pt != NULL) {
|
||||
iconv_ret= iconv_open(nl_langinfo(CODESET), name_pt);
|
||||
if(iconv_ret == (iconv_t) -1) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-%scharset: Cannot convert from charset %s",
|
||||
flag & 2 ? "" : "in_", Text_shellsafe(name_pt, sfe, 0));
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",
|
||||
0);
|
||||
return(0);
|
||||
} else
|
||||
iconv_close(iconv_ret);
|
||||
}
|
||||
if(Sregex_string(&(xorriso->in_charset), name_pt, 0) <= 0) {
|
||||
Xorriso_no_malloc_memory(xorriso, NULL, 0);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
if(flag & 2) {
|
||||
if(name_pt != NULL) {
|
||||
iconv_ret= iconv_open(nl_langinfo(CODESET), 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));
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",
|
||||
0);
|
||||
return(0);
|
||||
} else
|
||||
iconv_close(iconv_ret);
|
||||
}
|
||||
if(Sregex_string(&(xorriso->out_charset), name_pt, 0) <= 0) {
|
||||
Xorriso_no_malloc_memory(xorriso, NULL, 0);
|
||||
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);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* Option -check_media */
|
||||
int Xorriso_option_check_media(struct XorrisO *xorriso,
|
||||
int argc, char **argv, int *idx, int flag)
|
||||
@ -14670,11 +14760,12 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
|
||||
};
|
||||
static char arg1_commands[][40]= {
|
||||
"abort_on","add_plainly","backslash_codes","blank",
|
||||
"cd","cdi","cdx","close","commit_eject",
|
||||
"cd","cdi","cdx","charset","close","commit_eject",
|
||||
"dev", "dummy","dialog","disk_pattern","eject","iso_rr_pattern","follow",
|
||||
"format","fs","gid","grow_blindly",
|
||||
"history","indev","joliet","list_delimiter","mark","not_leaf",
|
||||
"not_list","not_mgt","options_from_file","osirrox","outdev","overwrite",
|
||||
"history","indev","in_charset","joliet","list_delimiter",
|
||||
"mark","not_leaf","not_list","not_mgt",
|
||||
"options_from_file","osirrox","outdev","out_charset","overwrite",
|
||||
"pacifier","padding","path_list","pathspecs","pkt_output","print","prompt",
|
||||
"prog","prog_help","publisher","quoted_not_list","quoted_path_list",
|
||||
"reassure","report_about","rom_toc_scan",
|
||||
@ -14866,6 +14957,10 @@ next_command:;
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_cdx(xorriso, arg1, 0);
|
||||
|
||||
} else if(strcmp(cmd,"charset")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_charset(xorriso, arg1, 3);
|
||||
|
||||
} else if(strcmp(cmd,"check_media")==0) {
|
||||
ret= Xorriso_option_check_media(xorriso, argc, argv, idx, 0);
|
||||
|
||||
@ -15049,6 +15144,10 @@ next_command:;
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_dev(xorriso, arg1, 1);
|
||||
|
||||
} else if(strcmp(cmd,"in_charset")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_charset(xorriso, arg1, 1);
|
||||
|
||||
} else if(strcmp(cmd,"iso_rr_pattern")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_iso_rr_pattern(xorriso, arg1, 0);
|
||||
@ -15131,13 +15230,17 @@ next_command:;
|
||||
if(ret==3)
|
||||
goto ex;
|
||||
|
||||
} else if(strcmp(cmd,"osirrox")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_osirrox(xorriso,arg1,0);
|
||||
|
||||
} else if(strcmp(cmd,"outdev")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_dev(xorriso, arg1, 2);
|
||||
|
||||
} else if(strcmp(cmd,"osirrox")==0) {
|
||||
} else if(strcmp(cmd,"out_charset")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_osirrox(xorriso,arg1,0);
|
||||
ret= Xorriso_option_charset(xorriso, arg1, 2);
|
||||
|
||||
} else if(strcmp(cmd,"overwrite")==0) {
|
||||
(*idx)++;
|
||||
|
@ -158,6 +158,7 @@ struct XorrisO { /* the global context of xorriso */
|
||||
char indev[SfileadrL];
|
||||
void *in_drive_handle; /* interpreted only by xorrisoburn.c */
|
||||
void *in_volset_handle; /* interpreted only by xorrisoburn.c */
|
||||
char *in_charset; /* The charset to interpret the filename bytes */
|
||||
|
||||
int volset_change_pending; /* whether -commit would make sense */
|
||||
int no_volset_present; /* set to 1 on first failure */
|
||||
@ -168,6 +169,7 @@ struct XorrisO { /* the global context of xorriso */
|
||||
|
||||
char outdev[SfileadrL];
|
||||
void *out_drive_handle; /* interpreted only by xorrisoburn.c */
|
||||
char *out_charset; /* The charset to produce the filename bytes for */
|
||||
int dev_fd_1; /* The fd which substitutes for /dev/fd/1 and is
|
||||
connected to externaly perveived stdout.
|
||||
*/
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2008.10.30.114313"
|
||||
#define Xorriso_timestamP "2008.11.03.115721"
|
||||
|
@ -402,7 +402,7 @@ int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag)
|
||||
return(ret);
|
||||
/* Note: no return before isoburn_ropt_destroy() */
|
||||
isoburn_ropt_set_extensions(ropts, isoburn_ropt_pretend_blank);
|
||||
isoburn_ropt_set_input_charset(ropts, NULL);
|
||||
isoburn_ropt_set_input_charset(ropts, xorriso->in_charset);
|
||||
isoburn_set_read_pacifier(drive, NULL, NULL);
|
||||
ret= isoburn_read_image(drive, ropts, &volset);
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
@ -613,7 +613,7 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
|
||||
goto ex;
|
||||
isoburn_ropt_set_extensions(ropts, isoburn_ropt_noiso1999);
|
||||
isoburn_ropt_set_default_perms(ropts, (uid_t) 0, (gid_t) 0, (mode_t) 0555);
|
||||
isoburn_ropt_set_input_charset(ropts, NULL);
|
||||
isoburn_ropt_set_input_charset(ropts, xorriso->in_charset);
|
||||
|
||||
Xorriso_set_image_severities(xorriso, 1); /* No DEBUG messages */
|
||||
Xorriso_pacifier_reset(xorriso, 0);
|
||||
@ -1130,6 +1130,15 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
{ret= 0; goto ex;}
|
||||
}
|
||||
|
||||
#ifdef Xorriso_with_make_isohybrid_mbR
|
||||
|
||||
/* ??? must the boot image have a low LBA to boot from MBR ? */
|
||||
isoburn_igopt_set_sort_files(sopts, isoburn_igopt_sort_files_by_weight);
|
||||
iso_node_set_sort_weight(node, 0x7fffffff);
|
||||
|
||||
#endif
|
||||
|
||||
ret= Xorriso_node_from_path(xorriso, image, xorriso->boot_image_cat_path,
|
||||
&node, 1);
|
||||
if(ret > 0) {
|
||||
@ -1230,7 +1239,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
||||
isoburn_igopt_set_sort_files(sopts, 1);
|
||||
isoburn_igopt_set_over_mode(sopts, 0, 0, (mode_t) 0, (mode_t) 0);
|
||||
isoburn_igopt_set_over_ugid(sopts, 0, 0, (uid_t) 0, (gid_t) 0);
|
||||
isoburn_igopt_set_out_charset(sopts, NULL);
|
||||
isoburn_igopt_set_out_charset(sopts, xorriso->out_charset);
|
||||
isoburn_igopt_set_fifo_size(sopts, xorriso->fs * 2048);
|
||||
|
||||
if(image!=NULL &&
|
||||
|
Loading…
Reference in New Issue
Block a user