我有一个网站,有一些文本框。如果用户填写包含字母“ë”的内容,则它会变成:
ë
如何将它像这样存储在数据库中? 我的网站是基于 .NET 构建的,我使用 C# 语言。
最佳答案
ASP.Net(您的服务器端应用程序)和 SQL Server 都支持 Unicode。它们可以处理不同的语言和不同的字符集:
http://msdn.microsoft.com/en-us/library/39d1w2xf.aspx
Internally, the code behind ASP.NET Web pages handles all string data as Unicode. You can set how the page encodes its response, which sets the CharSet attribute on the Content-Type part of the HTTP header. This enables browsers to determine the encoding without a meta tag or having to deduce the correct encoding from the content. You can also set how the page interprets information that is sent in a request.
Finally, you can set how ASP.NET interprets the content of the page itself — in other words, the encoding of the physical .aspx file on disk. If you set the file encoding, all ASP pages must use that encoding. Notepad.exe can save files that are encoded in the current system ANSI codepage, in UTF-8, or in UTF-16 (also called Unicode). The ASP.NET runtime can distinguish between these three encodings. The encoding of the physical ASP.NET file must match the encoding that is specified in the file in the @ Page encoding attributes.
这篇文章也很有帮助:
http://support.microsoft.com/kb/893663
这篇“Joel-on-Software”文章绝对是必读的
请阅读所有三篇文章,如果有帮助请告诉我们。
关于asp.net - 字母变成 "ë",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10338058/