diff --git a/aegisub/src/ass_dialogue.cpp b/aegisub/src/ass_dialogue.cpp index ae6187101..ff504bd17 100644 --- a/aegisub/src/ass_dialogue.cpp +++ b/aegisub/src/ass_dialogue.cpp @@ -671,6 +671,16 @@ void AssDialogue::ConvertTagsToSRT () { } } + // Ensure all tags are closed + if (isBold) + final += _T(""); + if (isItalic) + final += _T(""); + if (isUnder) + final += _T(""); + if (isStrike) + final += _T(""); + Text = final; UpdateData(); ClearBlocks(); diff --git a/aegisub/src/subtitle_format_srt.cpp b/aegisub/src/subtitle_format_srt.cpp index db3328fec..5c96369db 100644 --- a/aegisub/src/subtitle_format_srt.cpp +++ b/aegisub/src/subtitle_format_srt.cpp @@ -184,9 +184,15 @@ void SRTSubtitleFormat::WriteFile(wxString _filename,wxString encoding) { CreateCopy(); SortLines(); StripComments(); + // Tags must be converted in two passes + // First ASS style overrides are converted to SRT but linebreaks are kept + ConvertTags(2,_T("\\N")); + // Then we can recombine overlaps, this requires ASS style linebreaks RecombineOverlaps(); MergeIdentical(); - ConvertTags(2,_T("\r\n")); + // And finally convert linebreaks + ConvertTags(0,_T("\r\n")); + // Otherwise unclosed overrides might affect lines they shouldn't, see bug #809 for example // Write lines int i=1;