Java:java.io.Reader解码charset

时间:2014-12-06 12:55:52

标签: java

我有java.io.Reader对象:

in = request.getReader(); // put the stream in blocking mode

之后,我想从这个Reader中获取String对象。

final char[] buf = new char[128];
int read;
StringBuilder builder = new StringBuilder();
while ((read = in.read(buf)) != -1) {
   builder.append(buf, 0, read);
}
System.out.println(builder.toString());

这回复我这样的字符串:

ÑÑоÑ

如何使用UTF8字符集解析此Reader?

0 个答案:

没有答案