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 5 of 5
  1. #1
    Senior Coder BarrMan's Avatar
    Join Date
    Feb 2005
    Location
    Israel.
    Posts
    1,644
    Thanks
    69
    Thanked 83 Times in 82 Posts

    ASP: Working with ajax

    Hey. I've made a script that pulls information from my database to a textbox but it's not in english and it shows the letters instead of in their original form as question marks. (IE: Hello = ????).
    When I opened my database to see if the information is correct there I saw that it's ok but when it draws it from the database into the textarea I get this funny looking text.
    Here's my insertion code:
    Code:
    <%@ Language=VBScript %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html dir="rtl">
    <head>
    <title>
    טאודור בר - מערכת ניהול
    </title>
    <meta http-equiv="content-type" content="text/html; charset=windows-1255" />
    </head>
    <body>
    <%
    Function strFormat(str)
        If IsEmpty(str) or IsNull(str) Then Exit Function
        Str = Replace(str,"<","&lt;")
        Str = Replace(str,">","&gt;")
        Str = Replace(str,"'","&#39;")
        Str = Replace(str,"""","&quot;")
        Str = Replace(str,chr(13),"<br />")
        Str = Replace(str,"'","&#39;")
        strFormat = str
    End Function
    Dim Lang
    Dim Conn
    Dim Rs
    Dim SQL
    Lang = Request.Form("language")
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open = "PROVIDER=Microsoft.Jet.Oledb.4.0; Data Source='" & Server.MapPath("../db.mdb") & "'"
    SQL = "UPDATE contents SET content = '" & StrFormat(Request.Form("txt")) & "' WHERE page='index' AND lang='" & Lang & "'"
    Conn.Execute SQL
    Conn.Close
    Set Conn = Nothing
    Response.Redirect Request.Form("url")
    %>
    </body>
    </html>

  • #2
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Your title is a little deceiving, as this is not an AJAX problem, but a text encoding problem.

    So, here's a question --

    You say that when you look at the data in the database that it's OK, but when you retrieve it INTO a textbox, there is an encoding issue.

    Have you tried just doing a simple response.write or putting it into a DIV (or a PRE) to see if it returns correctly?
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #3
    Senior Coder BarrMan's Avatar
    Join Date
    Feb 2005
    Location
    Israel.
    Posts
    1,644
    Thanks
    69
    Thanked 83 Times in 82 Posts
    Quote Originally Posted by Daemonspyre View Post
    Your title is a little deceiving, as this is not an AJAX problem, but a text encoding problem.

    So, here's a question --

    You say that when you look at the data in the database that it's OK, but when you retrieve it INTO a textbox, there is an encoding issue.

    Have you tried just doing a simple response.write or putting it into a DIV (or a PRE) to see if it returns correctly?
    Hey. Sorry for the misleading title. Thought it's an AJAX problem.
    When I try to view it on a div the same error occurs.

  • #4
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    There have been a few posts as of late with regards to Hebrew ( Semitic ) alphabet.

    Make sure that you use a couple of little tricks:

    1) Make sure your page encoding is UTF-8. This is done with a META tag
    Code:
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    2) Make sure your Session.LCID = 1037 (numeric location code for Hebrew).

    More information on Locale IDs (LCID) can be found here.

    Let me know if this works for you.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #5
    Senior Coder BarrMan's Avatar
    Join Date
    Feb 2005
    Location
    Israel.
    Posts
    1,644
    Thanks
    69
    Thanked 83 Times in 82 Posts
    Not yet solved.
    Hey.
    Thanks for the help!
    I thought windows-1255 is the hebrew charset and that's what I used in my page but now I've tried yours and it still doesn't work.
    I've also added the Session.LCID = 1037 at the beginning of the page and still I get the same unidentified letters error.

    When I checked my ajax.asp document it showed the letters alright too.
    Last edited by BarrMan; 09-15-2007 at 04:49 PM.


  •  

    Posting Permissions

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