Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Mar 2011
    Posts
    41
    Thanks
    16
    Thanked 0 Times in 0 Posts

    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.

  • #2
    New Coder
    Join Date
    Mar 2011
    Posts
    41
    Thanks
    16
    Thanked 0 Times in 0 Posts
    nobody's here?!

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,602
    Thanks
    78
    Thanked 4,387 Times in 4,352 Posts
    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.

  • #4
    New Coder
    Join Date
    Mar 2011
    Posts
    41
    Thanks
    16
    Thanked 0 Times in 0 Posts
    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.

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,602
    Thanks
    78
    Thanked 4,387 Times in 4,352 Posts
    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.

  • Users who have thanked Old Pedant for this post:

    Datis (07-12-2012)

  • #6
    New Coder
    Join Date
    Mar 2011
    Posts
    41
    Thanks
    16
    Thanked 0 Times in 0 Posts
    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?

  • #7
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,602
    Thanks
    78
    Thanked 4,387 Times in 4,352 Posts
    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.

  • Users who have thanked Old Pedant for this post:

    Datis (07-14-2012)

  • #8
    New Coder
    Join Date
    Mar 2011
    Posts
    41
    Thanks
    16
    Thanked 0 Times in 0 Posts
    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.

  • #9
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,602
    Thanks
    78
    Thanked 4,387 Times in 4,352 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •