英文讀取中文的亂碼問題

zhantianyou 2009-12-15 01:19:52
各位大俠,我用asp從vfp中的dbf文件讀取數據,再插入到SQL數據庫中,在中文系統上還好,但在英文系統上時,從vfp上讀取出來的就是亂碼,結果插入到SQL中也是亂碼。有什麽方法解決沒有??
...全文
150 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
sixth_sense_ 2010-01-05
  • 打赏
  • 举报
回复
帮顶
ender129 2009-12-17
  • 打赏
  • 举报
回复
恩 我只能解决你这网页的 呵呵 因为我遇到过这个问题 我师傅教我的
但是呢 vfp 这部分 我不会 所以不好办
哈特比尔波 2009-12-16
  • 打赏
  • 举报
回复
在英文系统下更新中文支持。
zhantianyou 2009-12-16
  • 打赏
  • 举报
回复
其實加上ender129所說可以,是頁面上的可以顯示出來,但是,從vfp上讀取出來仍然為亂碼。
ender129 2009-12-15
  • 打赏
  • 举报
回复
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>这句话改成下面的三行格式 试试 如果不行 你再按我的这种格式加上一个<%@LANGUAGE="VBSCRIPT"%> 变成4行

<%@ CODEPAGE=65001%>
<%Response.CodePage=65001%>
<%Response.Charset="UTF-8"%>
gingerkang 2009-12-15
  • 打赏
  • 举报
回复
一般指定
response.codepage
session.codepage
response.charset
就看不到乱码了
zhantianyou 2009-12-15
  • 打赏
  • 举报
回复
是啊!不然中文在英文系統出現亂碼了
ayouori 2009-12-15
  • 打赏
  • 举报
回复
将数据内容转成utf-8码
zhantianyou 2009-12-15
  • 打赏
  • 举报
回复
我用response.write只是用調試用的。最終只是要rsVfpCust("name")這些值存放到數據庫當中。而我調到這裏,就發現在在讀時,就已經亂碼了。所以。。。。
bing475879749 2009-12-15
  • 打赏
  • 举报
回复
ASP语句开头加

Response.Charset = "utf-8"

zhantianyou 2009-12-15
  • 打赏
  • 举报
回复
急救啊。
然後我在該SQL中,直接輸中文又可以顯示,結果就推倒我認為是英文系統欠編碼的想法。這個是什麽問題哦??分不夠,你可以提出來。
zhantianyou 2009-12-15
  • 打赏
  • 举报
回复
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="dbconn.inc"-->
<!--#include file="js.asp"-->
<!--#include file="fuction.asp"-->
<!--#include file="sample.css"-->
<%Server.ScriptTimeOut=100000%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<%
call GetRight(Session("userid"),"C03",true)

strconn1="Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB="+server.mappath("masDB")+";Exclusive=No;"
'strconn1="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("msDB.mdb")
'strconn1="Driver={Microsoft Excel Driver (*.xls)};DBQ=" & Server.MapPath("msDB.xls")

set conn1 = server.createobject("adodb.connection")
'response.write strconn1
'response.end
conn1.Open strconn1
%>

<%
'set rsVfpCust=conn1.execute("select * from customer order by code")
'set rsVfpCust=conn1.execute("select * from customer ")
set rsVfpCust=conn1.execute("select top 10 code,name,cname,contact1,ctel1,cfax1,cemail1,salescode1,address1,address2,address3,address4,address5,lastupdate,MasVersion from webcustomer order by code")

i=0
while not rsVfpCust.eof
strSQL="select * from customer where custcode='"& replace(trim(rsVfpCust("code")),"`","") &"'"
set rs=server.createobject("adodb.recordset")
rs.open strSQL,conn,3,3
if rs.eof then
rs.addnew
rs("lastupdate")=cdate("01/01/1900")
end if

response.write (rsVfpCust("name")+" "+rsVfpCust("address1")+" "+rsVfpCust("address2")+" "+rsVfpCust("address3"))這裏輸出來就是亂碼了

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧