Maybe I could use to_json. I needed this because I end up using this string for javascript which doesn't do automatic multiline strings.