Add method to escape strings

Change-Id: Icf2effa47a51f4e45f36f3e8f8c398081c52c243