Missing Char encoding type on socket.write()

Make socket.write use same encoding as socket.setEncoding, set by params or default.