Skip to content

Commit

Permalink
Merge pull request #47 from jacekll/master
Browse files Browse the repository at this point in the history
Fix error parsing JSON with apostrophe in data
  • Loading branch information
Torann authored Apr 25, 2019
2 parents 368a66e + 3623a79 commit 4d43922
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function generate()
{
$properties = $this->getProperties();

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

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/ContextTypes/ProductTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ProductTest extends TestCase
'category' => 'Droppables / Anvils',
'model' => 'Acme Exec. Anvil',
'image' => 'http://www.example.com/anvil_executive.jpg',
'description' => 'Sleeker than ACME\'s Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height.',
'description' => 'Sleeker than ACME\u0027s Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height.',
'sku' => '925872',
'brand' => 'Acme Inc.',
'aggregateRating' => [
Expand Down

0 comments on commit 4d43922

Please sign in to comment.