bugfix for ingoring the encoding

when I deal with  Chinese character,  the output is wrong， after read the source code , I found the encoding parameter is ingnored.