Fixed handling of single quotes/lines in TTXT, but still at a loss on how to decode the line properly (a sample that actually has an apostrophe would be useful)
Originally committed to SVN as r1244.
This commit is contained in:
parent
c9c8f41e1f
commit
b41c288677
1 changed files with 16 additions and 1 deletions
|
@ -114,10 +114,25 @@ void TTXTSubtitleFormat::ReadFile(wxString filename,wxString forceEncoding) {
|
||||||
|
|
||||||
// Create line
|
// Create line
|
||||||
if (!text.IsEmpty()) {
|
if (!text.IsEmpty()) {
|
||||||
|
// Process text
|
||||||
|
wxString finalText;
|
||||||
|
finalText.Alloc(text.Length());
|
||||||
|
bool in = false;
|
||||||
|
bool first = true;
|
||||||
|
for (size_t i=0;i<text.Length();i++) {
|
||||||
|
if (text[i] == _T('\'')) {
|
||||||
|
if (!in && !first) finalText += _T("\\N");
|
||||||
|
first = false;
|
||||||
|
in = !in;
|
||||||
|
}
|
||||||
|
else if (in) finalText += text[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create dialogue
|
||||||
diag = new AssDialogue();
|
diag = new AssDialogue();
|
||||||
diag->Start = time;
|
diag->Start = time;
|
||||||
diag->End.SetMS(time.GetMS()+5000);
|
diag->End.SetMS(time.GetMS()+5000);
|
||||||
diag->Text = text;
|
diag->Text = finalText;
|
||||||
diag->group = _T("[Events]");
|
diag->group = _T("[Events]");
|
||||||
diag->Style = _T("Default");
|
diag->Style = _T("Default");
|
||||||
diag->Comment = false;
|
diag->Comment = false;
|
||||||
|
|
Loading…
Reference in a new issue