fix utf-8 encoding issue

use a StringReader instead of ByteArrayInputStream to fix the utf-8 encoding issue, fixes #1