How do I declare a string with both single and double quotes in YAML? How do I declare a string with both single and double quotes in YAML? ruby ruby

How do I declare a string with both single and double quotes in YAML?


escaping should be done like this

"When you're using double quotes, they look like \"this\""


Actually I can’t figure out why do you need obsolete typewriter quotes in translation strings. There is 2013 around and we are not stuck to ASCII-7 anymore. The typography rules dictate their demands to use unicode quotation marks.

That’s the best practice ever: map those within 3rd keyboard level (or, eventually, sed your yml):

"When you’re using double quotes, they look like “this”"

With such an approach you’ll never run into troubles with escaping and your clients will definitely say “oh, neat.”

Sorry, if this seems a little bit off-topic, but since the question was about translation strings, I still consider it to be the best solution.


See if this works for you, it works perfectly for me in my spring boot applications where I needed to pass JSON values in:

Using YAML pipe style:

app.json:  values: |    {"key": "value"}

Your case would be:

en:  my_string: |    When you're using double quotes, they look like "this"

Folded style might work too but I haven't tried.

See more here: http://symfony.com/doc/current/components/yaml/yaml_format.html#strings