#173858 by myself: skip UTF-8 BOM when importing locale files

6.x
Gábor Hojtsy 2007-11-21 18:24:37 +00:00
parent 70d494620c
commit 8e73e4600b
1 changed files with 4 additions and 0 deletions

View File

@ -1015,6 +1015,10 @@ function _locale_import_read_po($op, $file, $mode = NULL, $lang = NULL, $group =
while (!feof($fd)) { while (!feof($fd)) {
$line = fgets($fd, 10*1024); // A line should not be this long $line = fgets($fd, 10*1024); // A line should not be this long
if ($lineno == 0) {
// The first line might come with a UTF-8 BOM, which should be removed.
$line = str_replace("\xEF\xBB\xBF", '', $line);
}
$lineno++; $lineno++;
$line = trim(strtr($line, array("\\\n" => ""))); $line = trim(strtr($line, array("\\\n" => "")));