Skip to content
Extraits de code Groupes Projets
Valider 10579dcf rédigé par Thomas Goyne's avatar Thomas Goyne
Parcourir les fichiers

Read strings from Matroska as UTF-8

Strings in Matroska files are all either UTF-8 or a UTF-8 subset, not
whatever the current locale happens to be.
parent 18a46610
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -161,9 +161,9 @@ void MatroskaWrapper::GetSubtitles(wxString const& filename, AssFile *target) { ...@@ -161,9 +161,9 @@ void MatroskaWrapper::GetSubtitles(wxString const& filename, AssFile *target) {
// Subtitle track // Subtitle track
if (trackInfo->Type == 0x11) { if (trackInfo->Type == 0x11) {
wxString CodecID = wxString(trackInfo->CodecID,*wxConvCurrent); wxString CodecID = wxString::FromUTF8(trackInfo->CodecID);
wxString TrackName = wxString(trackInfo->Name,*wxConvCurrent); wxString TrackName = wxString::FromUTF8(trackInfo->Name);
wxString TrackLanguage = wxString(trackInfo->Language,*wxConvCurrent); wxString TrackLanguage = wxString::FromUTF8(trackInfo->Language);
// Known subtitle format // Known subtitle format
if (CodecID == "S_TEXT/SSA" || CodecID == "S_TEXT/ASS" || CodecID == "S_TEXT/UTF8") { if (CodecID == "S_TEXT/SSA" || CodecID == "S_TEXT/ASS" || CodecID == "S_TEXT/UTF8") {
...@@ -185,7 +185,7 @@ void MatroskaWrapper::GetSubtitles(wxString const& filename, AssFile *target) { ...@@ -185,7 +185,7 @@ void MatroskaWrapper::GetSubtitles(wxString const& filename, AssFile *target) {
else { else {
int choice = wxGetSingleChoiceIndex(_("Choose which track to read:"), _("Multiple subtitle tracks found"), tracksNames); int choice = wxGetSingleChoiceIndex(_("Choose which track to read:"), _("Multiple subtitle tracks found"), tracksNames);
if (choice == -1) if (choice == -1)
throw agi::UserCancelException("cancelled"); throw agi::UserCancelException("canceled");
trackToRead = tracksFound[choice]; trackToRead = tracksFound[choice];
} }
...@@ -193,7 +193,7 @@ void MatroskaWrapper::GetSubtitles(wxString const& filename, AssFile *target) { ...@@ -193,7 +193,7 @@ void MatroskaWrapper::GetSubtitles(wxString const& filename, AssFile *target) {
// Picked track // Picked track
mkv_SetTrackMask(file, ~(1 << trackToRead)); mkv_SetTrackMask(file, ~(1 << trackToRead));
trackInfo = mkv_GetTrackInfo(file,trackToRead); trackInfo = mkv_GetTrackInfo(file,trackToRead);
wxString CodecID = wxString(trackInfo->CodecID,*wxConvCurrent); wxString CodecID = wxString::FromUTF8(trackInfo->CodecID);
bool srt = CodecID == "S_TEXT/UTF8"; bool srt = CodecID == "S_TEXT/UTF8";
bool ssa = CodecID == "S_TEXT/SSA"; bool ssa = CodecID == "S_TEXT/SSA";
...@@ -243,7 +243,7 @@ bool MatroskaWrapper::HasSubtitles(wxString const& filename) { ...@@ -243,7 +243,7 @@ bool MatroskaWrapper::HasSubtitles(wxString const& filename) {
TrackInfo *trackInfo = mkv_GetTrackInfo(file, track); TrackInfo *trackInfo = mkv_GetTrackInfo(file, track);
if (trackInfo->Type == 0x11) { if (trackInfo->Type == 0x11) {
wxString CodecID = wxString(trackInfo->CodecID, *wxConvCurrent); wxString CodecID = wxString::FromUTF8(trackInfo->CodecID);
if (CodecID == "S_TEXT/SSA" || CodecID == "S_TEXT/ASS" || CodecID == "S_TEXT/UTF8") { if (CodecID == "S_TEXT/SSA" || CodecID == "S_TEXT/ASS" || CodecID == "S_TEXT/UTF8") {
mkv_Close(file); mkv_Close(file);
return true; return true;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter