0

i have a Turkish string as "Sitemizi beğeniyor musunuz?" in Cookie

i have a webpage. 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>

Code file: 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

when load this page first time not any problem

text of Label1 = "Sitemizi beğeniyor musunuz?"

but when i load second time or more

text of Label1 = "Sitemizi beÄ?eniyor musunuz?"

i already set web.config

<system.web> 
<globalization requestEncoding="iso-8859-9" responseEncoding="iso-8859-9" culture="tr-TR" uiCulture="tr" fileEncoding="iso-8859-9" />
</system.web>
Güven Acar
  • 95
  • 1
  • 10

1 Answers1

0

You should URLEncode the cookies before you set them and URLDecode when you retrieve them. There is a good description of the allowed characters in cookies here: Allowed characters in cookies

Community
  • 1
  • 1
theduck
  • 2,589
  • 13
  • 17
  • 23