?
Solved

get method with chinese character

Posted on 2009-04-22
2
Medium Priority
?
502 Views
Last Modified: 2012-06-21
Dear ASP experts,

i'm trying to do a dictionary search, I'm using a get variable and retrieving the result with request.querystring, If I pass an english word it works fine, but if I pass a chinese character it returns question mark(?):

Eg 1.
http://www.test.com/testpage.asp?word=tree
the word value is tree

Eg2.
http://www.test.com/testpage.asp?word=l
(I put chinese character "gong1")
the word value is ?

my codepage=65001and Response.CharSet = "utf-8".

Thanks in advance,


<% @ codepage=65001 %>
<%
Response.CharSet = "utf-8"
'testpage.asp
response.expires=-1
getword = request.querystring("word")
response.write getword
 
%>

Open in new window

0
Comment
Question by:perfectshark
1 Comment
 
LVL 12

Accepted Solution

by:
Dimitris earned 2000 total points
ID: 24212490
Your problem is that you right the char directly to the Address Bar.
If you use the code bellow in IE you will see that the char is transited in URLEncode form
so for example the
} becomes %E3%81%BD
› becomes %E3%86%9B
u becomes %E3%89%B5 and so on

so if you call the page by submitting (as bellow) the url encode will work at its own
If you call it through ASP code then do this
Response.Redirect "mypage.asp?word="  & Server.URLEncode("My Characters.")
 
<%@Language="VBScript" codepage=65001%>
<%
Response.CharSet = "utf-8"
'testpage.asp
response.expires=-1
getword = request.querystring("word")
response.write getword
 
%>
<html>
<body>
<form  method =get >
	<input type=text id=word name=word>
	<input type=submit >
</form>
</body>
</html>

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

850 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