Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-11-2012, 12:02 PM   PM User | #1
Datis
New Coder

 
Join Date: Mar 2011
Posts: 41
Thanks: 16
Thanked 0 Times in 0 Posts
Datis is an unknown quantity at this point
Weird problem with search in db through search page

Hey folks, I face a really weird problem, I currently working on a search form for a company that has Arabic letters for their users first name and last name, the problem is that the web page I designed using vb script and sql2005 db cant show the results for any search using Arabic letters. For being sure that the problem is with Arabic letters I placed bunch of records with English alphabet and the search was successful so a record like John as first name and Man as last name was found.

Details of work: two asp classic pages, one contain a HTML form with get method that send three values: 1) first name, 2) last name, 3)submit button name, the second page contains a recordset filtered by two request.querystring parameters (both pages have charset=utf-8 set and Arabic characters are showing fine in the second page URL in FF and chrome but if I copy from those browsers and paste it here they appear encoded like IE8.)

Since IE 8 is an old crap it shows the arabic letters in url like this:
Code:
http://localhost/panel/user-names.asp?FirstName=%D8%A2%D8%B1%D8%B4&SurName=%D8%AA%D8%B3%D8%AA&button=%D9%86%D9%85%D8%A7%DB%8C%D8%B4+%D9%86%D8%AA%D8%A7%DB%8C%D8%AC
But in Chrome and FF its like this :
Code:
localhost/panel/user-names.asp?FirstName=آرش&SurName=تست&button=نمایش+نتایج
is it because of decode?
is it because of UTF?
is it because of database?
is it because of anything else?

Please help me out here folks.



first page (contains the form).
Code:
<form name="My_Choice" method="get" action="user-names.asp"  >
	       
<input name="FirstName" type="text" class="mediumfield" id="FirstName" value="" />

<input name="SurName" type="text" class="mediumfield" id="SurName" value="" />
           
<input name="button" type="submit" class="submit" id="button" value="نمایش نتایج" />
          
</form>

Second page (recordset) yes this is Dreamweaver generated code with my customization

Code:
<%
Dim rs_list1__MMColParam1
rs_list1__MMColParam1 = "0"
If (Request.QueryString("FirstName")   <> "") Then 
  rs_list1__MMColParam1 = Request.QueryString("FirstName")  
End If
%>


<%
Dim rs_list1__MMColParam2
rs_list1__MMColParam2 = "0"
If (Request.QueryString("SurName")   <> "") Then 
  rs_list1__MMColParam2 = Request.QueryString("SurName")  
End If
%>


<%
Dim rs_list1
Dim rs_list1_cmd
Dim rs_list1_numRows

Set rs_list1_cmd = Server.CreateObject ("ADODB.Command")
rs_list1_cmd.ActiveConnection = MM_admin_trustees_STRING
rs_list1_cmd.CommandText = "SELECT * FROM dbo.LoginUsers WHERE FirstName = ? AND SurName = ? ORDER BY SurName ASC" 
rs_list1_cmd.Prepared = true
rs_list1_cmd.Parameters.Append rs_list1_cmd.CreateParameter("param1", 200, 1, 255, rs_list1__MMColParam1) ' adVarChar
rs_list1_cmd.Parameters.Append rs_list1_cmd.CreateParameter("param2", 200, 1, 255, rs_list1__MMColParam2) ' adVarChar

Set rs_list1 = rs_list1_cmd.Execute
rs_list1_numRows = 0
%>

Last edited by Datis; 07-11-2012 at 12:13 PM..
Datis is offline   Reply With Quote
Old 07-11-2012, 03:10 PM   PM User | #2
Datis
New Coder

 
Join Date: Mar 2011
Posts: 41
Thanks: 16
Thanked 0 Times in 0 Posts
Datis is an unknown quantity at this point
nobody's here?!
Datis is offline   Reply With Quote
Old 07-11-2012, 07:18 PM   PM User | #3
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,555
Thanks: 62
Thanked 4,054 Times in 4,023 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
You can *try* specifically setting the LCID (LoCale IDentifier).

Session.LCID = xxxx

where xxxx is the proper LCID number.

Table of LCIDs various spots on MSDN. One is here:
http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx

And also here:
http://msdn.microsoft.com/en-us/goglobal/bb895996
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote
Old 07-11-2012, 08:44 PM   PM User | #4
Datis
New Coder

 
Join Date: Mar 2011
Posts: 41
Thanks: 16
Thanked 0 Times in 0 Posts
Datis is an unknown quantity at this point
Quote:
Originally Posted by Old Pedant View Post
You can *try* specifically setting the LCID (LoCale IDentifier).

Session.LCID = xxxx

where xxxx is the proper LCID number.

Table of LCIDs various spots on MSDN. One is here:
http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx

And also here:
http://msdn.microsoft.com/en-us/goglobal/bb895996
I tested it in both pages but the problem yet stands! help me pls The problem was with the URL which was not in a correct format pls take a look at those URLs samples from my first post again (that's my exact problem).

Last edited by Datis; 07-11-2012 at 08:50 PM..
Datis is offline   Reply With Quote
Old 07-11-2012, 09:16 PM   PM User | #5
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,555
Thanks: 62
Thanked 4,054 Times in 4,023 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Hmmm...both of them are really the same thing. The encoding of
آرش
*is*
%D8%A2%D8%B1%D8%B4
according to Server.URLEncode.

I'm not sure why either one should cause a problem.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote
Users who have thanked Old Pedant for this post:
Datis (07-12-2012)
Old 07-12-2012, 07:20 AM   PM User | #6
Datis
New Coder

 
Join Date: Mar 2011
Posts: 41
Thanks: 16
Thanked 0 Times in 0 Posts
Datis is an unknown quantity at this point
Quote:
Originally Posted by Old Pedant View Post
Hmmm...both of them are really the same thing. The encoding of
آرش
*is*
%D8%A2%D8%B1%D8%B4
according to Server.UURLRLEncode.

I'm not sure why either one should cause a problem.
Thanks, should it be decoded in the URL in second page and shown like آرش not %D8%A2%D8%B1%D8%B4? Vbscript doesn't have URLDecode built in it! so back in first page where admin enter the first and last name of a user should they be encoded in second page URL? for example if admin entered آرش as first name and میری as last name they both have to be in Arabic letters (not encoded) so the recordset in second page which filtered based on first and last name by request.querystring could go and find آرش میری in database! Am I right? If so, then how could I pass these either not encoded or maybe decoded in second page?
Datis is offline   Reply With Quote
Old 07-12-2012, 08:30 PM   PM User | #7
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,555
Thanks: 62
Thanked 4,054 Times in 4,023 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
First of all, any time you use Request.QueryString("xxx") or Request.Form("xxx") VBScript (or, more correctly, the ASP engine) *automatically* does the URLDecode for you.

As to the rest, I can only say that it is *supposed* to work as you described. Many many years ago I worked with ASP in an environment that was supposed to handle both English and Japanese, and we used the Session.LCID and it worked. I don't really have any way to test that the the Arabic is working, so I don't know what else to telly you.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote
Users who have thanked Old Pedant for this post:
Datis (07-14-2012)
Old 07-14-2012, 10:08 AM   PM User | #8
Datis
New Coder

 
Join Date: Mar 2011
Posts: 41
Thanks: 16
Thanked 0 Times in 0 Posts
Datis is an unknown quantity at this point
Quote:
Originally Posted by Old Pedant View Post
First of all, any time you use Request.QueryString("xxx") or Request.Form("xxx") VBScript (or, more correctly, the ASP engine) *automatically* does the URLDecode for you.

As to the rest, I can only say that it is *supposed* to work as you described. Many many years ago I worked with ASP in an environment that was supposed to handle both English and Japanese, and we used the Session.LCID and it worked. I don't really have any way to test that the the Arabic is working, so I don't know what else to telly you.
Maybe I used session.LCID in a wrong place! where exactly do I have to use it ? Can you please take a look at the first post again (code sections) and give me a lead where I have to use session.LCID? thanks.
Datis is offline   Reply With Quote
Old 07-14-2012, 09:39 PM   PM User | #9
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,555
Thanks: 62
Thanked 4,054 Times in 4,023 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Put Session.LCID as the first thing on the page.

Because it *IS* "Session" that means that so long as the session is active it is in effect. But of course if somebody turns off cookies then they get a new session on each page, so the safest thing is to put it at the top of each page. So long as it is on the page BEFORE you do any Request("xxx") or ADO operations, it should work.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:02 AM.


Advertisement
Log in to turn off these ads.