gb2312 shoud be reasonable.

解决方案 »

  1.   

    output流设置的是输出时的编码格式吧,生成的文档里仍然是UTF-8google了一下,网上的例子都是先读后写的,没看到有中间更改这个的……
      

  2.   

    用StringBufferReader作为Reader,生成一段字符串。该字符串的encoding标识你可以transformer.setOutputProperty(OutputKeys.Encoding, Chaset1)来实现;写入文件或向网络发送outputStream.write(xmlcontent.getByte(Charset1));自己摸索一下