我照书上也用TRIM()没这事啊,难道真是中文的问题/
解决方案 »
- 来高手帮我看下这个题目吧!
- 帮忙解释一下接口的耦合,完全耦合,接藕,看书不大懂~
- AudioFormat 构造函数
- jbuilder2006写的类不能在tomcat4.1下运行吗?
- 在JAVA连接数据库中newInstance()方法是什么意思
- JAVA基础,经典吗?看看我程序那里有错误啊?
- 请问RMI协议和远程通讯技术有什么关系呢?
- JAVA如何连接数据库操作,怎么会报错阿,如何排错阿!!!
- 在Dialog关闭的同时是触发一个jframe中的jtable刷新???在线等待呀!
- 域名
- 请教weblogic+jb8运行jsp网页出错,thx了先
- 因受朋友之托,请哪位大虾随手写一个小程序给我。。。。谢谢~~~~
我用的是1.3版本
还有那个中文的问题,
求助呀!!!!!
谢谢
trim()好像对en文环境有用吧
str1=new String(str.getBytes(),"8859_1");
写入时编码:(不是正好合适你的代码)
try {
//下一行最最要,进行ISO-8859-1编码
content = new String(content.getBytes(), "ISO-8859-1");
String sql = "insert into messages (content, sendtime) values (? + content + "?now())"; dbConn.executeUpdate(sql);
} catch(UnsupportedEncodingException e) {
} 读取时转换!
String strs = new String(str.getBytes(),"GBK"); 因为你从文件中读取时用字节流的方式!只能读取低7位还是低8位(低位字节)
我试试研究一下!
import java.io.*;
public class FileOutputDemo {
public static void main(String args[]) {
try {
FileOutputStream fos=new FileOutputStream("111.txt");
DataOutputStream out=new DataOutputStream(fos);
try {
String str="中国";
out.writeBytes(new String(str.getBytes(), "ISO-8859-1"));
}
catch(IOException e) {
System.out.println(e);
}
try {
out.close();
}
catch(Exception e)
{}
}
catch(FileNotFoundException e) {
System.out.println(e);
e.printStackTrace();
}
try
{
FileReader doc = new FileReader("D:\\jdk1.3\\bin\\111.txt");
BufferedReader buff = new BufferedReader(doc);
String line= buff.readLine();
while (line!=null)
{
System.out.println(line);
line = buff.readLine(); } buff.close();
doc.close();
} catch (IOException e) {
System.out.println("Error -- " + e.toString());
} }
}
太感谢了
向你们致敬!!!!!!
我爱java!