8000 Fix error parsing JSON with apostrophe in data by jacekll · Pull Request #47 · Torann/json-ld · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix error parsing JSON with apostrophe in data #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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