473,513 Members | 2,441 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Escaping unicode characters!

Hi!

Can someone explain how ASP works when it comes to unicode characters on the
querystring? See the testcode below. If you type in a chinese character in
the first textbox and click "post" the javascript code will change the
action for the <form> and add the text entered in the first editbox to the
querystring and then submit the form. Then the value on the querystring (id)
will be presented in the second textbox.

1. In my example for example chinese characters will be OK regardless if I
use the javascript escape or encodeURIComponent. If I check
alert(escape(document.frm.txt.value)) or
alert(encodeURIComponent(document.frm.txt.value)); they are certainly not
the same but IIS seems to fix this anyway. Is this just a coincidence or is
IIS handling the querystring correct regardless if I use the escape or
encodeURIComponent? Is the request object doing a implicit unescape for me?

2. The javascript escape should according to my reference guide not support
unicode characters but If I run the example below and use escape and type in
a chinese character it is show correct after I submit. I must be missing
something here (this maybe is a javascript thing but....)
'#######Name file test.asp###########
<%@ Language=VBSCRIPT CodePage=65001%>
<html>
<body>
<meta Content-Type="text/html" Charset="utf-8">
<form name="frm" action="test.asp" method="post">
<input type="text" name="txt">
<input type="text" name="txt2" value="<%=request.querystring("id")%>">
<input type="button" onclick="run();" value="post">
</form>

<script language="javascript">
function run()
{
document.frm.action="test.asp?id=" + escape(document.frm.txt.value);
//document.frm.action="test.asp?id=" +
encodeURIComponent(document.frm.txt.value);
document.frm.submit();
}

</script>
</body>
</html>
'#######End file test.asp###########

Regards
/Hans
Jul 19 '05 #1
0 2013

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

Similar topics

0
1948
by: Lisa | last post by:
I need to apply the HTML formatting tags and the French accented characters in a XML document. The XML is generated from a database that has HTML tags and French accented characters in the records....
48
4578
by: Zenobia | last post by:
Recently I was editing a document in GoLive 6. I like GoLive because it has some nice features such as: * rewrite source code * check syntax * global search & replace (through several files at...
4
3156
by: Basil | last post by:
Hello. I have compiler BC Builder 6.0. I have an example: #include <strstrea.h> int main () { wchar_t ff = {' s','d ', 'f', 'g', 't'};
7
8999
by: Michael Davis | last post by:
Hi, I've known C/C++ for years, but only ever used ascii strings. I have a client who wants to know how gcc handles unicode. I've found the functions utf8_mbtowc, utf8_mbstowcs, utf8_wctomb and...
18
34071
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found...
3
5363
by: Taras_96 | last post by:
Hi everyone, I'm having a bit of trouble understanding the purpose of escaping nulls, and the use of addcslashes. Firstly, the manual states that: "Strictly speaking, MySQL requires only...
1
2368
by: =?Utf-8?B?bWljaGFlbHJp?= | last post by:
We are dynamically changing the title property of nodes in our sitemappath to reflect the names of products by handling the SiteMapResolve event. We have some unicode characters in our product...
3
11780
by: Greg R. Broderick | last post by:
Y'all: I am needing some way, in the SQL Server dialect of SQL, to escape unicode code points that are embedded within an nvarchar string in a SQL script, e.g. in Java I can do: String str =...
7
4101
by: wannymahoots | last post by:
optparse seems to be escaping control characters that I pass as arguments on the command line. Is this a bug? Am I missing something? Can this be prevented, or worked around? This behaviour...
0
7259
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
7158
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
7380
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5085
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1592
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.