asp.net - 字母变成 "ë"

标签 asp.net .net sql-server

我有一个网站,有一些文本框。如果用户填写包含字母“ë”的内容,则它会变成:

ë

如何将它像这样存储在数据库中? 我的网站是基于 .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/

相关文章:

c# - 为什么我们在 Encoder.GetBytes 方法中使用刷新参数

asp.net - Owin 中的 Global.asax 中有 Application_End 吗?

c# - 如何在 .NET 中获取 Unix 时间戳?

sql - 如果两个序列之间的差异大于30,则扣除更大的序列

sql-server - 如何在 T-SQL 中编写 select case

sql - 将XML批量导入SQL Server

asp.net - 当第一次在 UpdatePanel 中回发时加载控件/验证器时,如何使用自定义 ValidatorUpdateDisplay 函数?

asp.net - 阻止浏览器用详细信息填充文本框

javascript - 在 javascript 中使用文本框文本

mysql - "Could not load file or assembly ' MySql.Web“但是我没有使用MySQL?