-Added -bom

This commit is contained in:
cfsmp3 2014-10-11 10:39:56 +02:00
parent 15616edea8
commit 5f68a9166f
3 changed files with 16 additions and 0 deletions

View File

@ -1,6 +1,10 @@
0.75
-----------
- CCExtractor can be used as library if compiled using cmake
- By default the Windows version adds BOM to generated UTF files (this is
because it's needed to open the files correctly) while all other
builds don't add it (because it messes with text processing tools).
You can use -bom and -nobom to change the behaviour.
0.74
-----------

View File

@ -6,8 +6,10 @@ void init_options (struct ccx_s_options *options)
{
#ifdef _WIN32
options->buffer_input = 1; // In Windows buffering seems to help
options->no_bom = 0;
#else
options->buffer_input = 0; // In linux, not so much.
options->no_bom = 1;
#endif
options->nofontcolor=0; // 1 = don't put <font color> tags
options->notypesetting=0; // 1 = Don't put <i>, <u>, etc typesetting tags

View File

@ -477,8 +477,13 @@ void usage (void)
mprint (" affects Teletext in timed transcript with -datets.\n");
mprint ("\n");
mprint ("Options that affect what kind of output will be produced:\n");
mprint(" -bom: Append a BOM (Byte Order Mark) to output files.");
mprint(" Note that most text processing tools in linux will not");
mprint(" like BOM.");
mprint(" This is the default in Windows builds.");
mprint(" -nobom: Do not append a BOM (Byte Order Mark) to output files.");
mprint(" Note that this may break files when using Windows.");
mprint(" This is the default in non-Windows builds.");
mprint (" -unicode: Encode subtitles in Unicode instead of Latin-1.\n");
mprint (" -utf8: Encode subtitles in UTF-8 (no longer needed.\n");
mprint (" because UTF-8 is now the default).\n");
@ -865,8 +870,13 @@ void parse_parameters (struct ccx_s_options *opt, int argc, char *argv[])
ccx_options.nofontcolor=1;
continue;
}
if (strcmp(argv[i], "-bom") == 0){
ccx_options.no_bom = 0;
continue;
}
if (strcmp(argv[i], "-nobom") == 0){
ccx_options.no_bom = 1;
continue;
}
if (strcmp (argv[i],"-nots")==0 ||
strcmp (argv[i],"--notypesetting")==0)