Fixes #17053.  Delay escaping special characters so that character counts are accurate.  Added automated test.

git-svn-id: http://svn.dojotoolkit.org/src/branches/1.9/dijit@31413 560b804f-0ae3-0310-86f3-f6aa0a117693