Skip to content

Escaping application/ld+json? #352

@simPod

Description

@simPod

Version: 3.0.12

Bug Description

I did not find a way how to force latte to escape double quotes in a json string. There's noescape helper but no escape helper or sth. Docs says latte should escape automatically but it does not seem to do so.

Steps To Reproduce

https://fiddle.nette.org/latte/#f147ffe9e0

{var $text = '"lorem" ipsum'}
<script id="json-ld-script" type="application/ld+json">
    {"text": "{$text}"}
</script>

It generates invalid json {"text": ""lorem" ipsum"}

Expected Behavior

Escaped double quotes

Possible Solution

Escape "

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions