From 5358623d1cd8081921de744ae426afc669e780f5 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Mon, 23 Jul 2018 00:20:52 +1000 Subject: [PATCH] * Subtitle::BASE : strip unicode BOM if present --- lib/Subtitle/BASE.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Subtitle/BASE.pm b/lib/Subtitle/BASE.pm index 7d90342..3e65e50 100644 --- a/lib/Subtitle/BASE.pm +++ b/lib/Subtitle/BASE.pm @@ -37,6 +37,8 @@ sub from_file { or return -1; my @lines = <$FH>; close $FH; + return unless @lines; # empty file? + $lines[0] =~ s[^\x{EF}\x{BB}\x{BF}][]; # strip BOM return $self->parse(\@lines); }