-
Notifications
You must be signed in to change notification settings - Fork 616
Closed
Description
Hello together,
Unfortunately Pico didn't render my YAML content correctly. I was searching several hours until I found the issue in the regex:
$markdown = preg_replace($metaHeaderPattern, '', $rawContent, 1);I was able to reproduce the problem in a small script:
$metaHeaderPattern = "/^(\/(\*)|---)[[:blank:]]*(?:\r)?\n"
. "(?:(.*?)(?:\r)?\n)?(?(2)\*\/|---)[[:blank:]]*(?:(?:\r)?\n|$)/s";
// returns false
$rawContent = file_get_contents("C:\FILE WITH BOM");
$isMatch = preg_match($metaHeaderPattern, $rawContent) == 1;
// return true
$rawContent = file_get_contents("C:\FILE WITHOUT BOM");
$isMatch = preg_match($metaHeaderPattern, $rawContent) == 1;It seems that the regex replacement (and the markdown parsing too) is not able to handle files with UTF-8 BOM headers correctly.
One should not add BOMs anyway, but many text-editor do without users knowing it.
Could you add support for BOMs?