fix a bug

exchange the direction of ostream.
encode UTF-8