Escape quotes in strings properly. Fixes #1768.

Four tests might seems excessive given the same method is tested, but it took me those four tests to figure out I missed an escape. Also, don't depend on implementation details ;-) Furthermore, I think they have value in exercising possible paths to the routine. Since it's rather easy to forget to call _toString_ on some data I think the amount of testing is actually just about right.