Fixed setEncoding bug (#3)