Bug #91742
closedFluid view helper asset.script escape children
0%
Description
A variable (e.g. data.bodytext) holds json data. When using it in a fluid asset script view helper the resulting json code is escaped:
<f:asset.script identifier="pp-schema-{data.uid}" type="application/ld+json">
{data.bodytext}
</f:asset.script>
Escaped result:
<script type="application/ld+json">
{
"@context":"http://schema.org",
"@type":"Hotel",
The view helper script has escapeOutput disabled.
When creating a descendent view helper and setting escapeChildren to false the resulting code won't be escaped any more hence the output is as expected. According to the description it shouldn't be needed to disable escapeChildren:
"If escaping of children is disabled, no nodes that are passed with inline syntax or values used as tag content will be escaped. Note that $escapeOutput takes priority: if it is disabled, escaping of child nodes is also disabled unless explicitly enabled."
Updated by Georg Ringer about 4 years ago
- Related to Bug #92284: <f:asset.script> ViewHelper double escape the src attribute added
Updated by Simon Praetorius over 1 year ago
From my point of view, the actual behavior of this is correct. However, the documentation is unclear. I opened a pull request to fix this:
https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-CoreApi/pull/3129
Updated by Simon Praetorius over 1 year ago
- Status changed from Accepted to Resolved
This is now fixed in documentation. You should be able to use f:format.raw or f:format.json (then with array/object) to achieve the desired behavior.