Remove null chars from mkv text - thx taxen/mkver :)

Fix #2732
This commit is contained in:
Nikolaj Olsson 2018-02-03 12:03:26 +01:00
parent d0d55f202d
commit 03515f1786
2 changed files with 9 additions and 9 deletions

View File

@ -53,19 +53,17 @@ namespace Nikse.SubtitleEdit.Core.ContainerFormats.Matroska
{
}
public long End
{
get
{
return Start + Duration;
}
}
public long End => Start + Duration;
public string GetText(MatroskaTrackInfo matroskaTrackInfo)
{
var data = GetData(matroskaTrackInfo);
if (data != null)
return System.Text.Encoding.UTF8.GetString(data).Replace("\\N", Environment.NewLine);
{
return System.Text.Encoding.UTF8.GetString(data)
.Replace("\\N", Environment.NewLine)
.Replace("\0", string.Empty);
}
return string.Empty;
}
}

View File

@ -2271,7 +2271,9 @@ namespace Nikse.SubtitleEdit.Core
comments.Paragraphs.RemoveAt(commentIndex);
}
string text = mp.GetText(matroskaSubtitleInfo).Replace(Environment.NewLine, "\\N");
string text = mp.GetText(matroskaSubtitleInfo)
.Replace(Environment.NewLine + Environment.NewLine, "\\N")
.Replace(Environment.NewLine, "\\N");
int idx = text.IndexOf(',') + 1;
if (idx > 0 && idx < text.Length)
{