srt newlines are \r\n; add utf-8 BOM, fixes #2556

This commit is contained in:
j 2014-11-11 14:27:01 +01:00
parent 50b344321e
commit 4a354aa59e

View file

@ -744,15 +744,15 @@ Ox.formatRoman = function(number) {
Ox.formatSRT <f> Formats subtitles as SRT Ox.formatSRT <f> Formats subtitles as SRT
@*/ @*/
Ox.formatSRT = function(subtitles) { Ox.formatSRT = function(subtitles) {
return Ox.sortBy(subtitles, ['in', 'out']).map(function(subtitle, index) { return '\ufeff' + Ox.sortBy(subtitles, ['in', 'out']).map(function(subtitle, index) {
return [ return [
index + 1, index + 1,
['in', 'out'].map(function(key) { ['in', 'out'].map(function(key) {
return Ox.formatDuration(subtitle[key], 3).replace('.', ','); return Ox.formatDuration(subtitle[key], 3).replace('.', ',');
}).join(' --> '), }).join(' --> '),
subtitle['text'] subtitle['text']
].join('\n') ].join('\r\n')
}).join('\n\n'); }).join('\r\n\r\n');
}; };
/*@ /*@