I am trying to write a ruby string to a file in such a way that any newline characters embedded in the string remain embedded. This is being written out to a file which will then be processed by another tool.
An example is below.
I want this: 1 [label="this is a\ntest"] \n (second \n is a true newline)
I have tried this: string = '1 [label="this is a\ntest"]' + "\n"
Any thoughts?