The charset used during subtitle extraction defaults to UTF-8.

This commit is contained in:
Moritz Bunkus 2003-11-05 18:19:10 +00:00
parent a9155887c6
commit 0f85a04d61
4 changed files with 10 additions and 3 deletions

View File

@ -35,7 +35,7 @@ Command line syntax for the \fBtracks\fR extraction mode:
.TP .TP
\fB\-c\fR \fIcharset\fR \fB\-c\fR \fIcharset\fR
Sets the charset to convert the next text subtitle track to. Only valid if the Sets the charset to convert the next text subtitle track to. Only valid if the
next track ID targets a text subtitle track. next track ID targets a text subtitle track. It defaults to UTF-8.
.TP .TP
\fITID\fR:\fIoutname\fR \fITID\fR:\fIoutname\fR
Causes extraction of the track with the ID \fITID\fR into the file Causes extraction of the track with the ID \fITID\fR into the file

View File

@ -121,7 +121,7 @@ void usage() {
" on the mode.\n" " on the mode.\n"
"\n" "\n"
" First mode extracts some tracks to external files.\n" " First mode extracts some tracks to external files.\n"
" -c charset Convert text subtitles to this charset.\n" " -c charset Convert text subtitles to this charset (default: UTF-8).\n"
" TID:out Write track with the ID TID to the file 'out'.\n" " TID:out Write track with the ID TID to the file 'out'.\n"
"\n" "\n"
" Second mode extracts the tags and converts them to XML. The output is\n" " Second mode extracts the tags and converts them to XML. The output is\n"
@ -195,7 +195,8 @@ void parse_args(int argc, char **argv, char *&file_name, int &mode) {
file_name = argv[2]; file_name = argv[2];
conv_handle = 0; conv_handle = conv_utf8;
sub_charset = "UTF-8";
// Now process all the other options. // Now process all the other options.
for (i = 3; i < argc; i++) for (i = 3; i < argc; i++)
@ -244,6 +245,8 @@ void parse_args(int argc, char **argv, char *&file_name, int &mode) {
track.sub_charset = safestrdup(sub_charset); track.sub_charset = safestrdup(sub_charset);
tracks.push_back(track); tracks.push_back(track);
safefree(copy); safefree(copy);
conv_handle = conv_utf8;
sub_charset = "UTF-8";
} }
if ((mode == MODE_TAGS) || (mode == MODE_CHAPTERS)) if ((mode == MODE_TAGS) || (mode == MODE_CHAPTERS))
@ -315,6 +318,7 @@ int main(int argc, char **argv) {
#endif #endif
utf8_init(NULL); utf8_init(NULL);
conv_utf8 = utf8_init("UTF-8");
parse_args(argc, argv, input_file, mode); parse_args(argc, argv, input_file, mode);
if (mode == MODE_TRACKS) { if (mode == MODE_TRACKS) {

View File

@ -101,6 +101,7 @@ void show_error(const char *fmt, ...);
kax_track_t *find_track(int tid); kax_track_t *find_track(int tid);
bool extract_tracks(const char *file_name); bool extract_tracks(const char *file_name);
extern int conv_utf8;
void extract_tags(const char *file_name); void extract_tags(const char *file_name);
void extract_chapters(const char *file_name, bool chapter_format_simple); void extract_chapters(const char *file_name, bool chapter_format_simple);
void extract_attachments(const char *file_name); void extract_attachments(const char *file_name);

View File

@ -80,6 +80,8 @@ extern "C" {
using namespace libmatroska; using namespace libmatroska;
using namespace std; using namespace std;
int conv_utf8;
// }}} // }}}
// {{{ FUNCTIONS flush_ogg_pages(), write_ogg_pages() // {{{ FUNCTIONS flush_ogg_pages(), write_ogg_pages()