Let's try without BOM

This commit is contained in:
Szymon Porwolik
2025-11-21 02:45:34 +01:00
parent 6c943e7747
commit a03a6e4b26
5 changed files with 9 additions and 6 deletions

View File

@@ -157,8 +157,11 @@ class Geojson {
return null;
}
// Remove BOM if present
$geojsonData = preg_replace('/^\xEF\xBB\xBF/', '', $geojsonData);
// Remove BOM if present (UTF-8, UTF-16, UTF-32)
$geojsonData = preg_replace('/^\xEF\xBB\xBF|\xFF\xFE|\xFE\xFF|\x00\x00\xFE\xFF|\xFF\xFE\x00\x00/', '', $geojsonData);
// Additional cleanup: trim whitespace
$geojsonData = trim($geojsonData);
$data = json_decode($geojsonData, true);