Let\'s say that I have this string:
s = \'Hello!\'
Hello!
When I pass this variable to a template, I want it to be rendered as raw
You pretty much covered it, those are indeed all the ways to disable autoescaping.
Are you sure the value you are talking about is actually s = 'Hello!'?
s = 'Hello!'
My hunch is that you have additional escaping somewhere in that string...