Refactor and resolve garbled characters in gsp