Skip to content
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

yaml string values are escaped unexpectedly #72

Closed
olets opened this issue Jun 22, 2020 · 1 comment
Closed

yaml string values are escaped unexpectedly #72

olets opened this issue Jun 22, 2020 · 1 comment

Comments

@olets
Copy link

olets commented Jun 22, 2020

String variables are escaped differently depending on whether they are set in Twig or YAML

This is works as expected:

{# main.twig #}
{% set str = '\-' %}
{{ str }} {# outputs `-` #}

This does not:

# yaml
str: '\-'
{# main.twig #}
{{ str }} {# outputs `\-` #}

Fiddle: https://twigfiddle.com/zeewkl

@olets
Copy link
Author

olets commented Jun 24, 2020

This is not a YAML issue, backslash is automatically escaped in YAML. YAML str: \ --> JSON {"str": "\\"}. XML does too. Judging by testing INI on Twigfiddle, I bet that does too.

@olets olets closed this as completed Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant