Make ASP. NET + SQL server2k support Chinese Characters

Source: Internet
Author: User
Just made our ProgramIt supports Chinese characters. I will post the first article here
To put it bluntly, it is actually very simple, but it is still a detour. Write down and hope to be useful.
1. Web. config: Set the original
<Globalization requestencoding = "UTF-8" responseencoding = "UTF-8"/>
Change
<Globalization requestencoding = "gb2312" responseencoding = "gb2312" fileencoding = "gb2312"/>

2. there is no way to change the existing SQL Server database. You can only create a new database, and then change collation name to XXX next to chinese_prc_xxx. Bin is binary, CI = case insensitive, AI = accent insensitive, ks = Kana sensitive, Ws = width sensitive, I use ci_ai

3. The original database must be retrieved, but cannot be backed up/restore. Otherwise, collation will be changed. You can only use import/export.

4. I almost forgot to talk about it. All fields that want to store Chinese characters must change varchar to nvarchar (twice the occupied space)

The above said take a detour is because, when SQL Server has not changed, the requestencoding into ISO-8859-1 can also be supported, but every time you have to change encoding for Chinese, it is useless even if contenttype is set on the page. Because the HTTP header returned by the server already specifies Encoding As a iso-8859-1.

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.