468,315 Members | 1,403 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,315 developers. It's quick & easy.

Cookies special characters.

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
Oct 20 '08 #1
1 2511
After some experimenting, it seems that Server.UrlEncode and
Server.UrlDecode do the trick.
Oct 21 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Roy W. Andersen | last post: by
3 posts views Thread by Barry Olly | last post: by
reply views Thread by Nuro de Matos Carvalho | last post: by
5 posts views Thread by Doc | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.