最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

Asp.net中的页面乱码的问题

来源:懂视网 责编:小采 时间:2020-11-27 22:45:45
文档

Asp.net中的页面乱码的问题

Asp.net中的页面乱码的问题:1.<globalization requestEncoding=gb2312 responseEncoding=gb2312 /> 或者 <META http-equiv=content-type content=text/html; charset=gb2312> 2.下载文件时指定文件名,中文的文件名出现了乱码? Res
推荐度:
导读Asp.net中的页面乱码的问题:1.<globalization requestEncoding=gb2312 responseEncoding=gb2312 /> 或者 <META http-equiv=content-type content=text/html; charset=gb2312> 2.下载文件时指定文件名,中文的文件名出现了乱码? Res

1.<globalization
requestEncoding="gb2312"
responseEncoding="gb2312"
/>

或者

<META http-equiv="content-type" content="text/html; charset=gb2312">


2.下载文件时指定文件名,中文的文件名出现了乱码?

Response.AddHeader("Content-Disposition", "attachment; filename="+HttpUtility.UrlEncoding(filename.ToString ()));


3.如何识别字符串中是否包含韩文

http://search.csdn.net/Expert/topic/2456/2456407.xml?temp=.5485498

如果只有英文和韩文
/*******该函数返回字符串中除英文外的字符*********/
create function test(@a varchar(20))
returns varchar(20)
as
begin
declare @b varchar(20),@i int
set @b = ''
set @i = 1
while @i<= len(@a)
begin
if Upper(substring(@a,@i,1)) not between 'A' and 'Z'
set @b = @b + substring(@a,@i,1)
set @i = @i+1
end
return @b
end

Select dbo.test('aabc12dsa451')


--------------------
12451

(所影响的行数为 1 行)
--1.有关多国文字的,一定要用UNICODE判断!
--2.韩文UNICODE分两断: 12592->12687 44032->55203
相关网站:http://www.buja.8u8.com/eeeeee.htm


create function hw(@str Nvarchar(100))
returns int
as
begin
declare @a int
set @a=0
while @str<>'' and @a=0
begin
set @a=(case when unicode(left(@str,1)) between 12592 and 12687
or unicode(left(@str,1)) between 44032 and 55203
then 1
else 0 end)
set @str=right(@str,len(@str)-1)
end
return @a
end

--调用:
declare @a nvarchar(100)
set @a=N'abc中갃国123'
select dbo.hw(@a)

--return: 1


set @a=N'abc中国123'
select dbo.hw(@a)

--return: 0


4.为什么文件读出来的中文字符是乱码?

System.IO.StreamReader m_fs = System.IO.File.OpenText(Hfile_SelectFile.Value);
改为
System.IO.StreamReader m_fs = new System.IO.StreamReader(Hfile_SelectFile.Value,System.Text.Encoding.GetEncoding("gb2312"));


5.JMAIL 发邮件附件或者没有或者在正文中是乱码

http://community.csdn.net/Expert/topic/3172/3172047.xml?temp=.3463404

6.怎么解决查询字符串中文乱码问题?

查询内容用Server.UrlEncode编码

string url ="http://localhost/test/test.aspx?a="+ Server.UrlEncode("张三");

-->Server.UrlDecode()

文档

Asp.net中的页面乱码的问题

Asp.net中的页面乱码的问题:1.<globalization requestEncoding=gb2312 responseEncoding=gb2312 /> 或者 <META http-equiv=content-type content=text/html; charset=gb2312> 2.下载文件时指定文件名,中文的文件名出现了乱码? Res
推荐度:
标签: 乱码 页面 里面
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top