Skip to content

Commit 4d43922

Browse files
authored
Merge pull request #47 from jacekll/master
Fix error parsing JSON with apostrophe in data
2 parents 368a66e + 3623a79 commit 4d43922

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Context.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function generate()
5959
{
6060
$properties = $this->getProperties();
6161

62-
return $properties ? "<script type=\"application/ld+json\">" . json_encode($properties,JSON_UNESCAPED_UNICODE) . "</script>" : '';
62+
return $properties ? "<script type=\"application/ld+json\">" . json_encode($properties,JSON_HEX_APOS | JSON_UNESCAPED_UNICODE) . "</script>" : '';
6363
}
6464

6565
/**

tests/ContextTypes/ProductTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ProductTest extends TestCase
1313
'category' => 'Droppables / Anvils',
1414
'model' => 'Acme Exec. Anvil',
1515
'image' => 'http://www.example.com/anvil_executive.jpg',
16-
'description' => 'Sleeker than ACME\'s Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height.',
16+
'description' => 'Sleeker than ACME\u0027s Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height.',
1717
'sku' => '925872',
1818
'brand' => 'Acme Inc.',
1919
'aggregateRating' => [

0 commit comments

Comments
 (0)