我对 XML 编码有疑问。当我在 localhost 上使用 cp1251 编码创建 XML 时,一切都很酷
但是当我在服务器上部署我的模块时,xml 文件有不正确的符号,如“ФайлПФД
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
DOMSource source = new DOMSource(doc);
transformer.setOutputProperty(OutputKeys.ENCODING, "cp1251");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.transform(source, result);
String attach = writer.toString();
我该如何解决?