String strContent = "中文测试测试".toString();
要转换一下

解决方案 »

  1.   

    <%@ page contentType="text/html;charset=gb2312"%>
    <%@ page import="java.io.*" %>
    <%
    String filePath="c:/aa.txt";
    filePath=filePath.toString();
    File myFilePath=new File(filePath);
    if(!myFilePath.exists())
    myFilePath.createNewFile();
    FileWriter resultFile=new FileWriter(myFilePath);
    PrintWriter myFile=new PrintWriter(resultFile);
    String strContent = "中文测试测试".toString();
    myFile.println(strContent);
    resultFile.close();
    %>
      

  2.   

    OutputStreamWriter out=new OutputStreamWriter((new FileOutputStream(myFilePath)),"GBK");
    out.write(strContent,0,strContent.length());
    主要是输出编码错误
      

  3.   

    http://www.51jsp.net/infoview/info.asp?ID=1138&Btype=FAQ
      

  4.   

    我试了一下我给你的代码
    在2000 下没问题
    可能是linux的编码问题
    问一句
    你的linux支持中文gb2312编码么
    如果不支持换这个试试 GBK
    <%@ page contentType="text/html;charset=GBK"%>
      

  5.   

    呵呵,ok了,把<%@ page contentType="text/html;charset=GBK"%>删掉就行了,都不知道为什么