Cookies special characters.

H

helveticus

Is it possible to write special html characters in a cookie? I'm
having difficulties reading these characters back out of the cookie:
the string representation is garbled. Strings with special chars are
rendered fine on my local machine but not with remote US server.

Using ISO 8859-1 characters codes such as é or é yield no
improvement. I've also tried UTF8 encoding to no avail as shown below.
TIA for any hints.

Read/write cookie functions (simplified) :

Private Sub ReadCookie()
...
Request.ContentEncoding = System.Text.Encoding.UTF8
Dim strCk As String = CStr(Request.Cookies(cok)(cpageName))
...
End Sub

Private Sub WriteCookie()
...
Dim strCk As String = String.Format("{0}", Me.hdr.InnerHtml)
Response.ContentEncoding = Encoding.UTF8
...
End Sub
 
H

helveticus

After some experimenting, it seems that Server.UrlEncode and
Server.UrlDecode do the trick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top