Add escape functionality to string.substitute.

This is https://bugs.dojotoolkit.org/ticket/18207.