Refactored the readString() method so that it takes into account escaped
characters.