The problem of page garbled in asp.net

Source: Internet
Author: User

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

Or

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

2. When downloading files, specify the filename, the Chinese filename appears garbled?

Response.AddHeader ("Content-disposition", "attachment; Filename= "+httputility.urlencoding" (filename. ToString ()));

3. How to identify whether the string contains Korean

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

If only English and Korean

/*******该函数返回字符串中除英文外的字符*********/
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

(The number of rows affected is 1 rows)

--1. Regarding the multinational writing, must use the Unicode judgment!

--2. Korean Unicode divided by two: 12592->12687 44032->55203

Related websites: 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

--Call:

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.