【发布时间】:2013-05-10 01:17:09
【问题描述】:
从 java 中获取一个字符串并将其放入一个文本文件中。当字符串被写入时,它不包含 Â,但是当字符串在 word pad 中打开时,字符就会出现。
字符串没有:
Notice of Appeal:
Hamilton City Board of Education
字符串:
Notice of Appeal:
Â
Â
Hamilton City Board of Education
下面是写字符串
out = new BufferedWriter (new FileWriter(filePrefix + "-body" + ".txt"));
out.write("From: " + em.from);
out.newLine();
out.write("Sent Date: " + em.sentDate);
out.newLine();
out.write("Subject: " + em.subject);
out.newLine();
out.newLine();
out.newLine();
String temp = new String(emi.stringContent.getBytes("UTF-8"), "UTF-8");
out.write(temp);
我应该怎么做才能不让它们出现在写字板中?
【问题讨论】:
-
幕后发生了一些事情,你需要停下来。但是,我不确定我们如何能够根据您的帖子猜测它是什么。您可能需要向我们提供更多信息和相关代码,最好是sscce。
-
这是一个编码问题。确保您使用的是 UTF-8。