473,396 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

codepages and cookies

Hi...

I'm a little perplexed. <%@Codepage="65001" %> changes how IIS/ASP will
handle interpreting query string variables - i.e. it will read the
querystring as being utf-8 encoded.

However, I'm finding that it *doesn't* change how Response.Cookies or
Request.Cookies get read/written.

I've been testing with a little jscript asp page with the lines

if (String (Request.QueryString ("abc")) != "undefined")
Response.Cookies("abc") = Request.QueryString ("abc");
Response.Write (Request.QueryString ("abc"));

to take a value from the query string and pass it back out as a cookie. The
test value I was using was r%c3%a9sume (resume with an accented e). When the
code page is set to utf-8, it will properly interpret the urlencoded query as
a utf-8 string. It will output the right bytes with Response.Write.

But watching the headers produced by the request, it comes out encoded in
latin-1.
Set-Cookie: abc=r%E9sume; path=/

I checked the cookie rfc on w3c.org, and oddly it doesn't say much about how
to encode/interpret cookie NAME=VALUEs. The only comment on character set in
the spec is that a cookie *comment* has to be utf-8 encoded.

I couldn't find anything on the MSDN documentation that addressed cookie
character sets either.

Anyone else run into this?

Thanks
_mark
Jul 22 '05 #1
5 1741
Hi Mark,

I build a test smilar to yours but I get different cookies string in
request:

<HTTPHeaders>
<accept>image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword, */*</accept>
<accept-language>zh-cn</accept-language>
<accept-encoding>gzip, deflate</accept-encoding>
<user-agent>Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR
1.1.4322)</user-agent>
<host>localhost:8080</host>
<connection>Keep-Alive</connection>
<cookie>abc=r%C3%A9sume;
adAuthCookie=2D81B8B6162D1306F42C775C52BBB4E7EF241 8D5AA1AA2B05263A4829D294F1
055825F66B9CCA942B2325C5CBE7B3C99E73C24B25CE101475 6DCDF6288E4D6BE;
ASPSESSIONIDQAQCBCAT=OLIFHPFAINECBFCBOIBKHDMN</cookie>
</HTTPHeaders>

Currently I am working with Windows server 2003 and IE sp1. Is this same
with you?

Luke

Jul 22 '05 #2
Hi Luke...

My posting was reflecting what I saw on W2k.sp4, IIS 5.0,
IE.6.0.sp1+hotfixes. From the headers IIS produced, I got the impression
that IIS/ASP was always encoding cookies with latin 1. I.e. the Set-Cookie:
header coming out was already in latin1, despite the page being in 65001.

When you say you used W2003, I presume that also means IIS 6? I just ran
the same experiment on a similar box, and it seems that this question is
addressed more correctly in the newer version.

Thanks
_mark
Jul 22 '05 #3
Hi Mark,

Yes, I am working with IIS 6.0 on Win 2003. I think the difference on
cookie encoding may be related to client's environment. For example, the OS
or locale settings.

Luke

Jul 22 '05 #4
Hi Luke...

I beg to differ. I used the same client and client environment to test the
difference between IIS 5.0 and IIS 6.0 on 2003 (plus I watched the actual
Set-Cookie headers each produced), and it appears to be a definite change in
IIS/ASP's handling of cookies and encoding.

The browser just seems to stash the url-encoded string that the host gave
it, and returns it on subsequent requests.

It makes more sense to me the way IIS 6/ASP is handling things - that
cookies should follow the same codepage declaration that the Request and
Response objects do (as well as Server.UrlEncode).

Thanks
_mark
"[MSFT]" wrote:
Hi Mark,

Yes, I am working with IIS 6.0 on Win 2003. I think the difference on
cookie encoding may be related to client's environment. For example, the OS
or locale settings.

Luke

Jul 22 '05 #5
Hi Mark,

As I know, Session also has a CodePage property like:

<%@ CodePage="65001" %>
<%

Session.CodePage = 65001
%>

You may try this to see if the cookie's code can be changed.

Also, this article maybe helpful:

#International Active Server Pages
http://msdn.microsoft.com/library/en...asp?frame=true

Luke

Jul 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Brian Burgess | last post by:
Hi all, Anyone know of any special issues with storing cookies with ASP? I'm trying this with two browsers: One is IE 6.0 with cookies set to 'prompt'. This has been working properly as any...
20
by: Brian Burgess | last post by:
Hi all, Anyone know if this is possible? If so, on which page would the cookie be? .. On the page calling a function defined in the include file? thanks in advance.. -BB
9
by: | last post by:
Is it possible for a user to enable permanent cookies but disable session cookies.....this seems like a contradition yet this is what I appear to be reading in online articles?
1
by: John Taylor-Johnston | last post by:
I'm a University academic looking for a proper definition of JavaScript Cookies. http://www.CollegeSherbrooke.qc.ca/languesmodernes/604-HAE_Grammar_Practice/ I'm trying to decipher what...
6
by: Mark | last post by:
Hi... I've come across some weird bug with Response.Cookies. Or maybe it will be called "by design" but for the life of me I can't figure out what purpose it would serve. If you're setting a...
2
by: Joe Weinstein | last post by:
Hi all. I am debugging a problem where one version of a JDBC driver connects to an AS400 DB2 instance, and another doesn't. I am told to suspect that the DBMS may not accept UTF clients. I have...
8
by: CDARS | last post by:
Hi all, I have a confusing question on ASP.NET cookies usage: 1> Response.Cookies("test").value = Now 2> Response.Write(Request.Cookies("test").value) 3> 4> Response.write("<hr>") 5>...
6
by: Stephane | last post by:
Hi, I have a login page where if the user wants his access codes to be saved are set into a cookie. In the logout page, I want to delete those cookies. I tried this and this is not working at...
0
by: rn5a | last post by:
This is how I am creating & then reading cookies: <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) 'create cookies Response.Cookies("UserName").Value = "Ron"...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.