Support BOM at the beginning of content, fixes #372

This commit is contained in:
Stéphane Goetz 2016-07-28 23:19:03 +02:00
bovenliggende f7b47a6c19
commit 64edc31122
2 gewijzigde bestanden met toevoegingen van 7 en 2 verwijderingen

Bestand weergeven

@ -1,4 +1,4 @@
---
---
title: Hallo Welt
date: 12th December 1984
---

Bestand weergeven

@ -103,7 +103,12 @@ class Content extends Entry
$frontMatter = new FrontMatter();
$document = $frontMatter->parse($this->getContent());
$content = $this->getContent();
if (substr($content, 0, 3) == "\xef\xbb\xbf") {
$content = substr($content, 3);
}
$document = $frontMatter->parse($content);
$this->attributes = array_replace_recursive($this->attributes, $document->getData());
$this->setContent($document->getContent());