ASP. NET supports both simplified and Traditional Chinese

Source: Internet
Author: User

Recently, I was processing a website with two versions: Simplified Chinese and Traditional Chinese. I wanted to handle the traditional version separately (a little different from the simplified version), my machine and. net is a Simplified Chinese version, the page file is converted to big5 (save must be UNICODE), whether it is set charset page, or set responseencoding = "big5 ", or set response. contentencoding, response. charset. garbled characters are displayed. (I still don't know how to handle it. If any prawn knows, please kindly advise. Thank you !)

Finally, there is no way. I checked some information on the Internet and finally adopted a stupid method: to convert the Simplified Chinese Web page to traditional Chinese and then output it. The following is a specific implementation method, from the information found on the Internet:

Set response. Filter in page_load on the page:

Response. contentencoding = encoding. getencoding (936); // 936-Simplified Chinese codePage

Response. Filter = new gb2big5filter (response. Filter );

Response. charset = "big5 ";

The source code of gb2big5filter is as follows:

Public class gb2big5filter: Stream

{

Private stream _ sink;

Private long _ position;

Private const string _ SGB = @ "bao Bei Yu coin Bian bian bu financial ginseng silkworm residue miserable can Cang cabin Cang toilet side volume test Layer changrong mixed with changrong yundun shovel production explanation trembling farm taste long compensation sausage factory Chang qibo Che Chen linting support said Cheng Chi shame tooth Chong insects pet domain raise silk ugly cupboard kitchen stick Young Foundation storage touch passing sore Chuang hammer pure ready words give Cong shallots from the cluster together escape error to bring loan bear single letter give birth when Block dang Dao prayer guide stealing lamp Deng enemy di Ding Dian fishing tune stacking dingtalk top ingot order lost Dong frozen douxiao read gambling plating forging broken satin against the team of tons of blunt wins the goose amount of evil hungry er bait hair penalty valve Fan Fei Fen Feng FENG Yu Feng Fu of the calcium cover dry catch stalk Gan Gang gang pick put pigeon Ge chrome to Gong hook trench structure purchase enough Gu Yu hanging Guan hall used to Guan Guang GUI silicon guigui turtle rail rack cabinet guixiao roller tumble Guo over the hacker Han no. He Heng bang Hong Hu HU yao Hua painted words Huai Huan HUan Huang lie Bo Hui ruined bribery party will hide get goods curse machine accumulation hunger jiji Ji Jia pod cheek Jia K price Jian jiu alkali Jie Jian jian Jiang Xi award speak sauce glue pouring arrogant Jiao stir hinge Jiao handed over the shuttle chair jie session tight jin Jing jiu ju said according to saw fear drama Xiao Jue Jun Kai kai Shell course Ken Ku pants boast block wide Kuang que feed burst expanded wide wax la Lai LAN li Lian Liang Xiao Xi Liao Li Lian ling Qi cage ridge Ling Lou Si Lu furnace"

+ "Lu Al Lu Lun Luo Lu Lun Lu Ma ma code, Ma, Ma, Mao, Yao, ma, Mao, Ma, Mai, Mao, Mao, Wei, Ma, Mao, Ma, Mao, Mao, Mo, Ming mulou mu of sodium Na hard scratching the brain to get bored in the moles of the moles compensate spray Peng cheat floating frequency poor ping pu Qi Wei lead Qian Yan gun throw the wall was forced to grab the shovel bridge Qiao qiaoqiao stealing Qin's sleeping light hydrogen tilting please qingqiong's poor community's body drive right to persuade magpie to really let Rao disturb the hot tough to recognize rong soft grui Yun sprinkling SA Gill game San umbrella mourning sick sweep seed killing screens sun Delete flash Shaanxi Shan Yan injury enjoy burning Shao Yan photo deter set Shen Sheng shengshi Shi although the Sui-gu-su sued Su, with the Sui-gu-nian sun-wei, zomu, tangtan Tan Tang Tao Xi Teng tang the bald figure of the hydrocarbon copper system is coated with a group of baboons, which can be used to take the Tuo, elliptical so, bend the WAN, And the WAN wanwangwei violation is Wei, Wei, Wei Wen Wei vortex nest lie Wong Wu pollution Wu Xi milling Xi Xixia Xia Xian title Xian Po xian Xiang Xiao Xie Xiao Zheng XU Xu xuxuan Xuan XU Xu Xiao Zheng yan xuexun Xun Yan Qi Yang sample Yao ye yeye yi Yin Ying yong yongyou worried about the mail uranium Yu pre-Yu Yuan Yue Yun yunxiao miscellaneous disaster collection temporarily likes dirty dates, and selects ze thieves to get together"

+ "Zha rolling Rolling Brake gate fraud Zhai debt felt yarn rolling Rolling stack war Zhang account inflation Zhao Zhe zhe ge this Zhen Zheng card woven job hold paper throw quality lag Bell final kinds of swollen public pig axis wrinkle day sudden pig various candle vision Zho storage build zhuzhuan brick to earn pile Zhuang makeup Zhuang shape cone the pendant is decorated with turbidity, zstack, and zstack. The total number of zstack and zstack groups is the same as that of zstack. there are two schools in charge. during the peak hours zookeeper and zookeeper OF THE UNITED STATES why? please refer to the following link for more information: there are two major problems in the future. you can see all the characters in your ears. i'm sorry, I'm sorry. there are two major challenges: zookeeper zookeeper and zookeeper Radix the yundun"

+ "Zookeeper xiao Wei stew ye Yu CHAN Xiao titanium cobalt molybdenum taobaotaobaote bismuth and nitanium tungsten tunnel Tunnel | zookeeper cadmium was engraved into the zookeeper and zookeeper. zookeeper zookeeper please refer to the following documents for more information: zookeeper zookeeper please refer to the following link for more information: catfish catfish ";

Private const string _ tgb = @ "****************************************** please refer to the following link for more information: our senior vice president of Alibaba Cloud products and plants, senior vice president of Alibaba Cloud products, senior vice president of Alibaba Cloud Products please refer to the following link for more information: how can this problem be solved? How can this problem be solved? when I was using Alibaba Cloud, there was already a large number of computers in the country, which was just a few clicks. there have been several attempts to improve the performance of our customers, and the number of other users has been reduced. please refer to the following link for more information: alibaba Cloud's leading legal authority has been developing a number of standards and regulatory standards have been released. after reading this article, I will try again later. Then, when reading this article, I would like to continue reading the article again. some of our staff have been using our mobile phone numbers. They have been using Alibaba Cloud's mobile phone numbers. Our computation reports that Alibaba Cloud has been using Alibaba Cloud's mobile phone numbers. please refer to the following link for more information: please refer to the following link for more information: I think it is suggested that I have just opened a website which has been released. There are still some other websites that have been released. there are two major causes for this problem: please refer to the following link for more information: when there are too many other"

+ "When there is a fair amount of legal disclaimer, there is a fair amount of legal disclaimer. why is there a large number of concurrent users? Why is there no such problem? Why is there a large number of concurrent users? please refer to the following link for more information: there are two major reasons for this problem: please refer to the following link for more information: zookeeper zookeeper when reading this article, I was informed that some real-time experience has been reported when reading this article. when reading this article, I was notified of the number of such problems. there are too many problems when they occur. Please tell them that there are too many problems when they occur. in this article, I have been hearing from some technical experts who have been reading this article. please refer to the following link for more information: please try again later. some researchers have suggested that some technical candidates should be chosen. in our opinion, there are two major problems in our country. please refer to the following link for more information: our staff have already reached the upper limit of the number of concurrent users who have already reached the upper limit"

+ "Alibaba Cloud has been making a huge number of attacks, and has been making a huge number of attacks during the war. certificate certificate Certificate alibaba Cloud has published a number of Alibaba Cloud senior vice president of Alibaba Cloud's Senior Technical Support Team. please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information"

+ "Too many threads have been written into our tables before they are written into our tables. please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: when there are already too many other ";

Public gb2big5filter (Stream sink)

{

_ Sink = sink;

}

// The following members of stream must be overriden.

Public override bool Canread

{

Get {return true ;}

}

Public override bool canseek

{

Get {return true ;}

}

Public override bool canwrite

{

Get {return true ;}

}

Public override long length

{

Get {return 0 ;}

}

Public override long position

{

Get {return _ position ;}

Set {_ Position = value ;}
}

Public override long seek (long offset, system. Io. seekorigin direction)

{

Return _ sink. Seek (offset, direction );

}
Public override void setlength (long length)

{

_ Sink. setlength (length );

}

Public override void close ()

{

_ Sink. Close ();
}

Public override void flush ()

{
_ Sink. Flush ();
}

Public override int read (byte [] buffer, int offset, int count)

{

Return _ sink. Read (buffer, offset, count );
}

// Gb2312 936

// Big5 950

Public override void write (byte [] buffer, int offset, int count)

{

Encoding E = encoding. getencoding (936 );

String STR = E. getstring (buffer, offset, count );

For (INT I = 0; I <Str. length; I ++)
{
Int J = _ SGB. indexof (STR [I]);
If (J! =-1) STR = Str. Replace (_ SGB [J], _ tgb [J]);

}

E = encoding. getencoding (950 );
_ Sink. Write (E. getbytes (STR), 0, E. getbytecount (STR ));

}

}

(End)

Related Article

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.