Added support for escaping troublesome characters in tag content.

Change-Id: I7888bea7fde6d6d70826c73c83cda3d0d3e1e59c