I'm new to the JAVA world and spent a good 15 minutes trying to figure out why my single quotes were not being escaped! Thank you for your post, it saved me from more headache.