国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

Asp.net中的頁面亂碼的問題

2024-07-10 12:55:43
字體:
來源:轉載
供稿:網友

商業源碼熱門下載www.html.org.cn

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中&#44035;國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()

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 巩留县| 张家口市| 苗栗市| 金坛市| 宿迁市| 扎赉特旗| 乳源| 通城县| 台东县| 突泉县| 永春县| 潮州市| 靖江市| 东光县| 惠水县| 柳江县| 博湖县| 墨竹工卡县| 张家界市| 五家渠市| 禹城市| 嫩江县| 延津县| 五原县| 资阳市| 柞水县| 永胜县| 区。| 甘谷县| 灵石县| 平谷区| 瓦房店市| 历史| 陈巴尔虎旗| 喀喇| 敖汉旗| 连山| 乌拉特后旗| 玉林市| 文登市| 白山市|