gpt4 book ai didi

asp.net - 字母变成 "ë"

转载 作者:行者123 更新时间:2023-12-04 18:22:40 25 4
gpt4 key购买 nike

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

ë

我怎样才能像这样将它存储在数据库中?
我的网站建立在 .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”文章绝对是必读的
  • The Absolute Minimum Every Software Developer Absolutely Positively Must Know About Unicode (No Excuses!)

  • 请阅读所有三篇文章,如果有帮助,请告诉我们。

    关于asp.net - 字母变成 "ë",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10338058/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com