\u5b8c\u6210\u4efb\u52a1[\u529e\u5047\u8bc1],\u6d88\u80171\u70b9\u7cbe\u529b,\u83b7\u5f971\u70b9\u7ecf\u9a8c\u548c$290!
这是文本中的字符串,如何读入这些字符串并带转义输出?输出这样的结果:
“完成任务[办假证],消耗1点精力,获得1点经验和$290!“
而不是原样输出
这是文本中的字符串,如何读入这些字符串并带转义输出?输出这样的结果:
“完成任务[办假证],消耗1点精力,获得1点经验和$290!“
而不是原样输出
System.out.println(str);这样得到的结果不就是中文编码的结果么?
public static void main(String[] args) throws IOException {
FileInputStream file=new FileInputStream("test.txt");
BufferedReader reader=new BufferedReader(new InputStreamReader(file));
StringBuilder content=new StringBuilder();
String line=null;
while((line=reader.readLine())!=null)
{
content.append(line);
content.append(System.getProperty("line.separator"));
}
file.close();
reader.close();
System.out.println(content.toString());
}这是从test.txt中读取内容并输出的,你可以测试一下
\u5b8c\u6210\u4efb\u52a1...是保存在test.txt中的