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 09-13-2007, 10:02 AM   PM User | #1
BarrMan
Senior Coder

 
BarrMan's Avatar
 
Join Date: Feb 2005
Location: Israel.
Posts: 1,644
Thanks: 69
Thanked 83 Times in 82 Posts
BarrMan is on a distinguished road
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,"'","'")
    Str = Replace(str,"""","&quot;")
    Str = Replace(str,chr(13),"<br />")
    Str = Replace(str,"'","'")
    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>
BarrMan is offline   Reply With Quote
Old 09-13-2007, 03:22 PM   PM User | #2
Daemonspyre
Regular Coder

 
Join Date: Mar 2007
Posts: 505
Thanks: 1
Thanked 19 Times in 19 Posts
Daemonspyre is on a distinguished road
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?
__________________
Quote:
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.
Daemonspyre is offline   Reply With Quote
Old 09-14-2007, 03:18 PM   PM User | #3
BarrMan
Senior Coder

 
BarrMan's Avatar
 
Join Date: Feb 2005
Location: Israel.
Posts: 1,644
Thanks: 69
Thanked 83 Times in 82 Posts
BarrMan is on a distinguished road
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.
BarrMan is offline   Reply With Quote
Old 09-14-2007, 04:19 PM   PM User | #4
Daemonspyre
Regular Coder

 
Join Date: Mar 2007
Posts: 505
Thanks: 1
Thanked 19 Times in 19 Posts
Daemonspyre is on a distinguished road
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.
__________________
Quote:
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.
Daemonspyre is offline   Reply With Quote
Old 09-14-2007, 04:50 PM   PM User | #5
BarrMan
Senior Coder

 
BarrMan's Avatar
 
Join Date: Feb 2005
Location: Israel.
Posts: 1,644
Thanks: 69
Thanked 83 Times in 82 Posts
BarrMan is on a distinguished road
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 03:49 PM..
BarrMan is offline   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 09:32 PM.


Advertisement
Log in to turn off these ads.