mirror of
https://github.com/mpv-player/mpv
synced 2025-01-18 21:31:13 +00:00
Skip BOM at the beginning of text in ASS parser.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26302 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
7cc46c2e87
commit
994b2022c3
@ -647,7 +647,7 @@ static int process_fonts_line(ass_track_t* track, char *str)
|
||||
*/
|
||||
static int process_line(ass_track_t* track, char *str)
|
||||
{
|
||||
if (strstr(str, "[Script Info]")) { // FIXME: strstr to skip possible BOM at the beginning of the script
|
||||
if (!strncmp(str, "[Script Info]", 13)) {
|
||||
track->parser_priv->state = PST_INFO;
|
||||
} else if (!strncmp(str, "[V4 Styles]", 11)) {
|
||||
track->parser_priv->state = PST_STYLES;
|
||||
@ -690,7 +690,11 @@ static int process_text(ass_track_t* track, char* str)
|
||||
char* p = str;
|
||||
while(1) {
|
||||
char* q;
|
||||
for (;((*p=='\r')||(*p=='\n'));++p) {}
|
||||
while (1) {
|
||||
if ((*p=='\r')||(*p=='\n')) ++p;
|
||||
else if (p[0]=='\xef' && p[1]=='\xbb' && p[2]=='\xbf') p+=3; // U+FFFE (BOM)
|
||||
else break;
|
||||
}
|
||||
for (q=p; ((*q!='\0')&&(*q!='\r')&&(*q!='\n')); ++q) {};
|
||||
if (q==p)
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user