Cookie 图表集错误 page_load ASP.NET

Cookie chartset error page_load ASP.NET

我在 Cookie

中有一个土耳其语字符串 "Sitemizi beğeniyor musunuz?"

我有一个网页。 Survey.aspx

 <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Survey.aspx.vb" Inherits="Survey" Culture="tr-TR" UICulture="tr" %>

<!DOCTYPE html> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9" />
<html xmlns="http://www.w3.org/1999/xhtml" lang="tr">

<head runat="server"> 
<title></title> 
</head>
<body>
<form id="form1" runat="server">
<div> 
    <asp:Label ID="Label1" runat="server"></asp:Label>
 </div>
</form>
</body>
</html>

代码文件:Survey.aspx.vb

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
    Dim myCookie As HttpCookie = Request.Cookies("SurveyCookie")
    If myCookie IsNot Nothing Then
        Label1.Text = myCookie("Ask")
    End If
  End Sub

第一次加载此页面时没有任何问题

Label1 的文本 = "Sitemizi beğeniyor musunuz?"

但是当我加载第二次或更多次时

Label1 的文本 = "Sitemizi beÄ?eniyor musunuz?"

我已经设置了web.config

<system.web> 
<globalization requestEncoding="iso-8859-9" responseEncoding="iso-8859-9" culture="tr-TR" uiCulture="tr" fileEncoding="iso-8859-9" />
</system.web>

您应该在设置 cookie 之前对它们进行 URLEncode,并在检索它们时进行 URLDecode。此处对 cookie 中允许的字符有很好的描述:Allowed characters in cookies