Solved

nonEnglish in querystring

Posted on 2004-10-07
22
700 Views
Last Modified: 2008-02-01
Hi there
Suppose that I'm developing a search engine. I write this code for the first page:
=====================
search.htm
=====================
...
<form action="search.asp" method="GET">
<input type="text" name="keyword">
<input type="submit" value="  Search  ">
</form>
...


and this will be the very start point for the search.asp page, which just ensures that it can get the querystring! Here:
=====================
search.asp
=====================
...
<%
Response.Write Request.QueryString("keyword")
%>
...

Now. If I type such word in the search box: témpo
which has an accent on the "e", then submit the form, I will be sent to:
http://www.anydomain.com/search.asp?keyword=t%E9mpo
And the result of Response.Write command will be like this:
tmpo
And you see that %E9 standing for é has been omitted. This is what I don't want to happen.
Any solution is highly appreciated

Huji
0
Comment
Question by:huji
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 11
22 Comments
 
LVL 30

Expert Comment

by:VirusMinus
ID: 12247421
You can pass the values to an asp page by url with special charcters like "%_#fgf%234"

<%
bv=server.urlencode("desti_nation.asp")
va=server.urlencode("jeans")
%>

<a href="<%=bv%>?values=<%=va%>">click here</a>

we use request.querystring("values") in the destination asp page (desti_nation.asp) to read the values.

You can also use it like this

<a href="destination.asp?value= <%=Server.URLEncode("23,témpo,café) %>")enter</a>
0
 
LVL 30

Expert Comment

by:VirusMinus
ID: 12247425
alternately you could use the javascript escape() function which converts special characters into hexadecimal
0
 
LVL 14

Author Comment

by:huji
ID: 12247474
You have misunderstood the question my friend
I'm not looking for a way to perform a URLEncode task
Please read my question again.
Huji
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 30

Expert Comment

by:VirusMinus
ID: 12247481
ok this is what i tested -> it outputs t%E9mpo

<%
Response.write Server.URLEncode(Request.querystring("keyword"))
%>
0
 
LVL 14

Author Comment

by:huji
ID: 12247492
I'm checking it on my side. Wait online please
Huji
0
 
LVL 14

Author Comment

by:huji
ID: 12247509
No it didn't help!
I put that line on my side, and again get -> tmpo
No "E" is there'
Any idea?
Huji
0
 
LVL 30

Expert Comment

by:VirusMinus
ID: 12247603
ok try this in your ASP page ->

<%@LANGUAGE="JavaScript"%>
<%
var QueryVariable = new String( Request.QueryString("keyword") )
%>
<HTML>
The QueryString Value is: <%=QueryVariable%> <BR>
<%
if (QueryVariable != "")
      {
      QueryVariable=escape(QueryVariable)
%>

<%=QueryVariable%>

<%
      } //closing bracket for if statement.
%>
</HTML>
0
 
LVL 30

Expert Comment

by:VirusMinus
ID: 12247628
what sort of hosting do you have there? that coud be a factor. It worked on my end. Im using Server 2003, IIS 6.0. I also tested it on windows 2000 server IIS 5.0 AND Linux Server with Chilisoft ASP and both solutions worked
0
 
LVL 30

Expert Comment

by:VirusMinus
ID: 12247647
this link also confirms the solutions i gave you ->
http://www.kamath.com/codelibrary/cl006_url.asp
0
 
LVL 14

Author Comment

by:huji
ID: 12247648
Result:
The QueryString Value is: tmpo
tmpo
I am testing it on windows XP with IIS 5.0
You mean that you saved the above as a file named 1.asp and then browsed http://localhost/1.asp?keyword=t%E9mpo and it got témpo to you? Please reconfirm this.
Can you upload it somewhere for me please?
huji
0
 
LVL 14

Author Comment

by:huji
ID: 12247704
See, if I had t%E9mpo in my querystring, and wanted to change it to témpo then your solution was handy, but this is not what I'm looking for.
I say that I do not get tht encoded %E9 when I use request.querystring("keyword")
This is strange. I still ask you to upload your code somewhere for me.
Huji
0
 
LVL 30

Accepted Solution

by:
VirusMinus earned 500 total points
ID: 12247845
yes i saved that bit of code as an ASP file, I'm assuming you did the same?

Heres a link to my ASP pages

First solution (server.URLencode) -> http://www.feralclothing.com.au/test2.asp?keyword=t%E9mpo
Second solution -> (javascript escape) -> http://www.feralclothing.com.au/test1.asp?keyword=t%E9mpo

Note, displaying the querystring without any escaping shows témpo

Try your ASP pages without submitting from the form by typing in the keyword témpo and t%E9mpo and see what happens?
0
 
LVL 14

Author Comment

by:huji
ID: 12247883
OK. I accept that it is working fine. I'm checking why it is not working on my side... Any idea?
Huji
0
 
LVL 30

Expert Comment

by:VirusMinus
ID: 12247920
what browser are u using? try a diff one if u can.

Also are u using anything older than ASP 3.x?
0
 
LVL 14

Author Comment

by:huji
ID: 12247947
Well. I still have not understood why my THAT file didn't work. I deleted that file, and wrote the code again, in to a new file. And now it is working!!
Funny
Any ways, I appreciate your help. Though you have not found the answer to my question, I appreciate your help with the 500 points, and an A
Huji
0
 
LVL 30

Expert Comment

by:VirusMinus
ID: 12248020
It is strange..wonder if its worth the trouble trying to replicate the problem ;)

But i guess if its working now just stick with it.

Glad to be of help.
0
 
LVL 14

Author Comment

by:huji
ID: 12251283
VirusMinus. I now know why it didn't work. It was becuase I used a codepage of 65001 which is for UTF-8, while the page of interest was to be shown in Arabics.
***********************
For others reference:
I wanted to have a page, which code show the arabics words sent to the search page in querystring, in correct arabic way, and at the same time, able to connect to an Access DB which has Arabic words inside, and read them correctly too ( not at lots of ? marks!) and then compare them, to perform a search thing.
The result of my study on this issue: Codepage must be set to 1256 (arabics) and also charset must be set to windows-1256 (arabics).
Here we go:

<%@language="VBscript" codepage="1256"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
...

***********************
Huji
0
 
LVL 14

Author Comment

by:huji
ID: 12251308
Although VirusMinus was not the one who finally found the answer, I decided to give him the point, because his working code made me create a new page, and then I noticed that the one working has no codepage assigned! So his work made me reach to the brilliant idea.
Thanks VirusMinus,
Huji
0
 
LVL 30

Expert Comment

by:VirusMinus
ID: 12251540
nice.. min wain huji?
0
 
LVL 14

Author Comment

by:huji
ID: 12259377
Although EE has a trend of "one question per thread" but I want to ask a second question here in this thread: The very silly one:
What does "min wain" mean?!
Huji
0
 
LVL 30

Expert Comment

by:VirusMinus
ID: 12259447
i was trying my limited knowledge of arabic ;)

min wain ante .. where are you from.. right? sah?
0
 
LVL 14

Author Comment

by:huji
ID: 12262402
1)I am Iranian, not Arab.
2)As far as I know, the correct pronounciation is "min ain ant?"
3)I am doing this Arabic issue for somebody else. Albeit, since Farsi web design has some similarity to Arabic, in its character problems, the result of this question we answered here can be generalized to Farsi too.
Good bye
Huji
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question