Allow Carriage Returns

For issue #540 - these changes preserve the CR characters in templates so that they can appear in the generated output.

I have not created any tests for this other than confirming that it works in the only program that I currently use swig in ([hashids-tsql](https://github.com/waynebloss/hashids-tsql/)). If I have time to make some tests in the future, I will ~ but, perhaps @paularmstrong, you could take a look at these 2 commits and enlighten me as to why I needed the 2nd commit to make this work. Am I doing something wrong? Thanks!