From 0f85a04d615d56e962e3e10132cc911c06ab63bc Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 5 Nov 2003 18:19:10 +0000 Subject: [PATCH] The charset used during subtitle extraction defaults to UTF-8. --- doc/mkvextract.1 | 2 +- src/mkvextract.cpp | 8 ++++++-- src/mkvextract.h | 1 + src/mkvextract_tracks.cpp | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/mkvextract.1 b/doc/mkvextract.1 index 432beb37f..6e5c65716 100644 --- a/doc/mkvextract.1 +++ b/doc/mkvextract.1 @@ -35,7 +35,7 @@ Command line syntax for the \fBtracks\fR extraction mode: .TP \fB\-c\fR \fIcharset\fR 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 \fITID\fR:\fIoutname\fR Causes extraction of the track with the ID \fITID\fR into the file diff --git a/src/mkvextract.cpp b/src/mkvextract.cpp index 7480b9f5a..6ae771583 100644 --- a/src/mkvextract.cpp +++ b/src/mkvextract.cpp @@ -121,7 +121,7 @@ void usage() { " on the mode.\n" "\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" "\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]; - conv_handle = 0; + conv_handle = conv_utf8; + sub_charset = "UTF-8"; // Now process all the other options. 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); tracks.push_back(track); safefree(copy); + conv_handle = conv_utf8; + sub_charset = "UTF-8"; } if ((mode == MODE_TAGS) || (mode == MODE_CHAPTERS)) @@ -315,6 +318,7 @@ int main(int argc, char **argv) { #endif utf8_init(NULL); + conv_utf8 = utf8_init("UTF-8"); parse_args(argc, argv, input_file, mode); if (mode == MODE_TRACKS) { diff --git a/src/mkvextract.h b/src/mkvextract.h index baa04987b..f789b989c 100644 --- a/src/mkvextract.h +++ b/src/mkvextract.h @@ -101,6 +101,7 @@ void show_error(const char *fmt, ...); kax_track_t *find_track(int tid); bool extract_tracks(const char *file_name); +extern int conv_utf8; void extract_tags(const char *file_name); void extract_chapters(const char *file_name, bool chapter_format_simple); void extract_attachments(const char *file_name); diff --git a/src/mkvextract_tracks.cpp b/src/mkvextract_tracks.cpp index 73092de38..ce2021380 100644 --- a/src/mkvextract_tracks.cpp +++ b/src/mkvextract_tracks.cpp @@ -80,6 +80,8 @@ extern "C" { using namespace libmatroska; using namespace std; +int conv_utf8; + // }}} // {{{ FUNCTIONS flush_ogg_pages(), write_ogg_pages()