请教高人,编码问题

guanxf 2003-03-28 09:03:12
两个一摸一样的文件,显示内容不一样
一个是乱码,一个正常,均使用的是GBK编码
如果把那个乱码的编码改为gb2312也可以正常显示

地址:http://www.goldagri.com/nj110/nj110_details3.jsp?id=1346
这个是正常的
http://www.goldagri.com/nj110/nj110_details1.jsp?id=1346
这个是乱码

unix服务器,resin,默认编码是GBK
...全文
7 点赞 收藏 10
写回复
10 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
guanxf 2003-03-28
真的是一样的文件吗?

我把正常的那个nj110_details1.jsp下载了一下,然后改了个名字nj110_details3.jsp用ftp上传,nj110_details3.jsp就是不正常的,nj110_details1.jsp还是正常的
回复
guanxf 2003-03-28
while(str_content.hasMoreTokens()){
content_details=content_details+str_content.nextToken();
}
%>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" bgcolor="#C0C0C0">
<div align="center">
<table border="0" cellpadding="0" width="100%">
<tr>
<td width="12%" bgcolor="#FFFFFF" align="center"><font class="spec">技术编号</font></td>
<td width="19%" bgcolor="#FFFFFF">
<p align="center"><%=bean.getData("nj_id")%>
</td>
<td width="7%" bgcolor="#FFFFFF">
<p align="center">类  别
</td>
<td width="17%" bgcolor="#FFFFFF" height="20" align="center"><font color="#cc6633">
<jsp:include page="../zjzx/include_export_type_name.jsp" flush="true" >
<jsp:param name="eid" value="<%=bean.getData("nj_type").substring(0,2)%>" />
</jsp:include>
</font></td>
<td width="13%" bgcolor="#FFFFFF" height="20" align="center"><font class="spec">录入时间</font></td>
<td width="32%" bgcolor="#FFFFFF" height="20" align="center"><%=bean.getData("temp")%></td>
</tr>
<tr>
<td width="12%" bgcolor="#FFFFFF" align="center">标题名称</td>
<td bgcolor="#FFFFFF" colspan="5" height="20">
<p align="center"><font color="#804040"><%=bean.getData("nj_title")%></font>
</td>
</tr>
<tr>
<td width="12%" bgcolor="#FFFFFF" align="center">技术内容</td>
<td bgcolor="#FFFFFF" colspan="5">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="98%">
<tr>
<td width="100%"><font color="#804040"><%=content_details%> </font></td>
</tr>
</table>
</div>
</td>
</tr>
<%
String N1="",N2="",N3="",N4="";
N1 = bean.getData("nj_export");
if(N1==null || N1.equals("") || N1.equals("null")){
N1 = " ";
}
N2 = bean.getData("nj_occupation");
if(N2==null || N2.equals("") || N2.equals("null")){
N2 = " ";
}
N3 = bean.getData("nj_phone");
if(N3==null || N3.equals("") || N3.equals("null")){
N3 = " ";
}
%>
<tr>
<td width="12%" bgcolor="#FFFFFF" align="center">专 
家</td>
<td width="19%" bgcolor="#FFFFFF" height="20" align="center"><%=N1%></td>
<td width="7%" bgcolor="#FFFFFF">
<p align="center">专家职称
</td>
<td width="17%" bgcolor="#FFFFFF" align="center"> <%=N2%></td>
<td width="13%" bgcolor="#FFFFFF" align="center">联系电话</td>
<td width="32%" bgcolor="#FFFFFF" align="center"> <%=N3%></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<%
}
bean.close();
%>
</div>
</td>
</tr>
</table>

</div>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="774" height="80">
<tr>
<td><iframe src="../pot.htm" frameborder=0 marginheight=0 marginwidth=0 width=100% height=100% scrolling=no></iframe></TD>
</tr>
</table>
</center>
</div>

</body>

</html>
回复
guanxf 2003-03-28
<%@ page contentType = "text/html; charset=gbk" %>
<%@ page import = "agri.database.Link" %>
<%@ page import = "java.io.*" %>
<%@ page import = "java.util.*" %>
<jsp:useBean id="bean" scope="request" class="agri.database.Link" />
<jsp:setProperty name="bean" property="*" />
<%
String id = request.getParameter("id");

String query = "select nj_id,nj_type,nj_title,nj_content,nj_export,nj_occupation,nj_phone,to_char(nj_datetime,'YYYY-MM-DD hh24:mi') as temp from tbl_nj where nj_id='"+id+"'";

bean.executeQuery(query);
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>萧山农业信息网</title>
<STYLE type=text/css>.p {
FONT-SIZE: 9pt; LINE-HEIGHT: 20pt; FONT-FAMILY: "宋体"
}
A {
COLOR: #006633; FONT-FAMILY: "宋体"; TEXT-DECORATION: none
}
A:hover {
COLOR: #004f04; FONT-FAMILY: "宋体"; TEXT-DECORATION: underline
}
BODY {
FONT-SIZE: 9pt; FONT-FAMILY: "宋体"
}
TD {
FONT-SIZE: 9pt; sfont-family: "宋体"
}
.color {
FONT-WEIGHT: bold; FONT-SIZE: 12pt; COLOR: #804040
}
.a {
FONT-SIZE: 9pt
}
.downbor {
BORDER-RIGHT: #f0cc6b 1px solid; BORDER-TOP: #f0cc6b 0px solid; BORDER-LEFT: #f0cc6b 0px solid; BORDER-BOTTOM: #f0cc6b 1px solid
}
.downbor1 {
BORDER-RIGHT: #f0cc6b 0px solid; BORDER-TOP: #f0cc6b 1px solid; BORDER-LEFT: #f0cc6b 0px solid; BORDER-BOTTOM: #f0cc6b 1px solid
}
</STYLE>

<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>

<body topmargin="0" leftmargin="0">

<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="774" height="100">
<tr>
<td><iframe src="../top.htm" frameborder=0 marginheight=0 marginwidth=0 width=100% height=100% scrolling=no></iframe></TD> </tr>
</table>
</center>
</div>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="774">
<tr>
<td bgcolor="#000000">
<div align="center">
<table border="0" cellpadding="0" cellspacing="1" width="100%" height="20">
<center>
<tr>
<td width="100%" bgcolor="#7BC65A" height="20"> <a href="../index.htm"><font color="#FFFFFF">首页</font></a>
> 农技110咨询热线</td>
</tr>
</center>
<tr>
<td bgcolor="#7BC65A" height="20">
<p align="right"><a href="../index.jsp" target="_blank"><font color="#000000">网站首页</font></a>
| <a href="zxbz.htm"><font color="#000000"> 在线帮助</font></a>
| <a href="mailto:webmaster@goldagri.com"><font color="#000000">
联系网管</font></a> 
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>

<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="774" height="20">
<tr>
<td></td>
</tr>
</table>
</center>
</div>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="774" height="103">
<tr>
<center>
<td height="4" width="386"><font color="#FF6600" size="2"><b> 农技110咨询热线</b></font></td>
</center>
<td height="4" width="388">
<p align="right"><span class="spec">问题解决了吗?如果没有可以找</span><a class="text" href="../zjzx/zjzx01.jsp"><font color="#ff0000">专家咨询</font></a><font color="#ff0000"> 
</font>
</td>
</tr>
<center>
<tr>
<td height="8" width="774" colspan="2">
</td>
</tr>
</center>
<tr>
<td height="89" valign="top" width="772" colspan="2">
<div align="center">
<% if(bean.next()){ %>
<%
String content = bean.getData("nj_content");
String makeContent=new String();
String content_details=new String();
String content_temp=new String();

StringTokenizer strToken=new StringTokenizer(content,"\n");

if (strToken.hasMoreTokens()){
makeContent=strToken.nextToken();
}

while(strToken.hasMoreTokens()){
makeContent=makeContent+"<br>"+strToken.nextToken();
}

content_temp = makeContent;
//替换空格

StringTokenizer str_content=new StringTokenizer(content_temp," ");
/*
if (str_content.hasMoreTokens()){
content_details=str_content.nextToken();
}
*/
回复
alarda 2003-03-28
真的是一样的文件吗?

<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
</body>
</html>
回复
guanxf 2003-03-28
很长的
回复
laoer 2003-03-28
代码!
回复
icecloud 2003-03-28
请贴代码出来啊。
回复
guanxf 2003-03-28
地址:这个是乱码http://www.goldagri.com/nj110/nj110_details3.jsp?id=1346

这个是正常的http://www.goldagri.com/nj110/nj110_details1.jsp?id=1346

我刚说反了,hehe
回复
guanxf 2003-03-28
是不是真的没人直到啊?
回复
vcvj 2003-03-28
地址:这个是乱码http://www.goldagri.com/nj110/nj110_details3.jsp?id=1346

这个是正常的http://www.goldagri.com/nj110/nj110_details1.jsp?id=1346
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2003-03-28 09:03
社区公告
暂无公告