473,804 Members | 3,123 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hi, I need some help here!! Please

How to assign Unicode charter (like arabiac) to varibl in javascript

Nov 26 '06 #1
11 1832
sahm wrote:
How to assign Unicode charter (like arabiac) to varibl in javascript
Are you asking about Arabic characters? You can use a text editor that
supports Unicode and save your HTML documents with embedded scripts or
your external script files as UTF-8 then you can use the characters
literally e.g.

var s = "بال*ر وف العربية" ;

Or you can use Unicode escape sequences in JavaScript string literals e.g.

var s =
"\u0628\u0627\u 0644\u062D\u063 1\u0648\u0641\u 0020\u0627\u064 4\u0639\u0631\u 0628\u064A\u062 9";

Finally there is String.fromChar Code e.g.

var s = String.fromChar Code(1576, 1575, 1604, 1581, 1585, 1608, 1601,
32, 1575, 1604, 1593, 1585, 1576, 1610, 1577);

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 26 '06 #2
sahm wrote on 26 nov 2006 in comp.lang.javas cript:
How to assign Unicode charter (like arabiac) to varibl in javascript

t = '&#65177' // ? [use alt+grey65177 to type]

<http://srufaculty.sru. edu/david.dailey/javascript/unicode.htm>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Nov 26 '06 #3
Martin Honnen & Evertjan. Thanks for your Reply

In my web page javascript code get the arabiac charter from html text
box and I'm try to use Ajax in my code every time I try to send the
arabiac charter it wont accept it
Please help in this

Nov 26 '06 #4
sahm wrote on 26 nov 2006 in comp.lang.javas cript:
Martin Honnen & Evertjan. Thanks for your Reply

In my web page javascript code get the arabiac charter from html text
box and I'm try to use Ajax in my code every time I try to send the
arabiac charter it wont accept it
character?

[please always quote on usenet]

Perhaps show some code?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Nov 26 '06 #5
ASM
sahm a crit :
How to assign Unicode charter (like arabiac) to varibl in javascript
About arabiac I don't know its table-charset

in french :

= \xe9 where e9 is Hexa code for
The best is to write you code in utf-8 directly in arabian in your vars

And, of course, headers sent with html file tells it is in utf-8

--
Stephane Moriaux et son (moins) vieux Mac dj dpass
Stephane Moriaux and his (less) old Mac already out of date
Nov 26 '06 #6
VK

sahm wrote:
In my web page javascript code get the arabiac charter from html text
box and I'm try to use Ajax in my code every time I try to send the
arabiac charter it wont accept it
JavaScript "speaks" Unicode only: respectively it "sees" any page
content as Unicode characters: irrelevant to the encoding used to serve
the page: 8859-6, UTF-8, or something else. I strongly presume that in
your strings handling you are trying to use HTML entities or %-escape
sequences. That is the most common mistake. But as suggested an actual
code sample (or a URL) would greatly help.

Nov 26 '06 #7
sahm wrote:
In my web page javascript code get the arabiac charter from html text
box and I'm try to use Ajax in my code every time I try to send the
arabiac charter it wont accept it
Please show the relevant code and explain in more detail what "it won't
accept it" means. Do you get an error message? If so which one? Is the
character not correctly received on the server? How exactly are you
trying to send it to the server, what server side language/framework do
you use to receive it? There are a lot of settings that matter, for
instance how you encode the characters you send to the server, how the
server decodes them.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 27 '06 #8
Here is the code
This is HTML code
//////////////////////////////
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>AJAX with PHP: Quickstart</title>
<script type="text/javascript" src="quickstart .js"
charset="UTF-8"></script>
<head lang="ar">
<meta http-equiv="Content-Language" content="ar-bh">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1256">
</head>
<body onload='process ()'>
Server wants to know your name:
<input type="text" id="myName" />
<div id="divMessage " />
</body>
</html>
///////////////////////////////
This is javascript code
///////////////////////////////

var xmlHttp = createXmlHttpRe questObject();
function createXmlHttpRe questObject()
{
var xmlHttp;

if(window.Activ eXObject)
{
try
{
xmlHttp = new ActiveXObject(" Microsoft.XMLHT TP");
}
catch (e)
{
xmlHttp = false;
}
}

else
{
try
{
xmlHttp = new XMLHttpRequest( );
}
catch (e)
{
xmlHttp = false;
}
}

if (!xmlHttp)
{
alert("Error creating the XMLHttpRequest object.");
}
else
{
return xmlHttp;
}
}

function process()
{
if (xmlHttp.readyS tate == 4 || xmlHttp.readySt ate == 0)
{
//name =
String.fromChar Code(encodeURIC omponent(docume nt.getElementBy Id("myName").va lue));
//alert(name);
name = encodeURICompon ent(document.ge tElementById("m yName").value);
xmlHttp.open("G ET", "quickstart.php ?name=" + name, true);
xmlHttp.onready statechange = handleServerRes ponse;
xmlHttp.send(nu ll);
}
else
setTimeout('pro cess()', 1000);
}

function handleServerRes ponse()
{
if (xmlHttp.readyS tate == 4)
{
if (xmlHttp.status == 200)
{
xmlResponse = xmlHttp.respons eXML;
xmlDocumentElem ent = xmlResponse.doc umentElement;
helloMessage = xmlDocumentElem ent.firstChild. data;
document.getEle mentById("divMe ssage").innerHT ML =
'<i>' + helloMessage + '</i>';
setTimeout('pro cess()', 1000);
}
else
{
alert("There was a problem accessing the server: " +
xmlHttp.statusT ext);
}
}
}
\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \

This is PHP code
///////////////////////////////
<?php
header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes "?>';
echo '<response>';
$name = $_GET['name'];
$userNames = array('CRISTIAN ', 'BOGDAN', 'شالم', '*سين',
'YODA');
if (in_array(strto upper($name), $userNames))
echo 'Hello, master ' . htmlentities($n ame) . '!';
else if (trim($name) == '')
echo 'Stranger, please tell me your name!';
else
echo htmlentities($n ame) . ', I don\'t know you!';
echo '</response>';
?>
\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\ \

Nov 27 '06 #9
sahm wrote:
This is PHP code
Which PHP version do you have on the server? Have you thought about
sending XML to the server? That way you might have better chances to
correctly submit the Arabic characters as XML supports Unicode and as
PHP's XML parser supports UTF-8.

Your original request sounded as if you wanted to insert Arabic
characters in JavaScript program code but now it looks as if you simply
read out the content of a text input which has Arabic characters. That
should not pose any problems in modern browsers in terms of JavaScript,
the tricky issue is sending stuff to the server and receiving stuff from
the server and getting the encoding/decoding right, in particular with
PHP which treats its strings as sequences of bytes and does not have
support for Unicode unless you use extensions like mbstring.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 27 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1542
by: tgregg6 | last post by:
I need help with my problem I am stuck and I don't know what to do!!! The problem is: This program calculates the charges for DVD rentals where current releases cost $3.5 and all others cast $2.50. If a customer rents several DVDs, every third one of each type is free. You need to tell the user what their total cost of rental whould be based on the amount of Dvds the user enters(decides to rent). Based on the following input: 3 current 3...
7
2364
by: shaolinman829 | last post by:
I suck at regex's and I need a little hope. Hopefully there is a guru out there to help me on this one. I want to do a match on the following: one or more numeric characters zero or more blank spaces \s zero or more dash characters - I've tried everything I know for now, but I still can't get my unit test to pass my conditions above. Anyone out there who could help? Thanks so much.
2
1332
by: Dalton | last post by:
This is all kind of in another language to, I mean I understand most of the words in relation to programming, but my field of work/study is IT. Anyways, on to the problem. I am working on my 5th project and it is running, just not the way it is supposed to. In the "posting guidelines" section it says not to post the whole source code, but that is all I know to do because I have no idea where the problem is. I asked a friend, who is a literally...
3
1173
by: DragonLord | last post by:
Here is the situation I am inserting rows into a datagridview and then using a function to group similar rows together based on a column. When I call to compare the lastrow with the current row the application passes the information that should be equal. i.e 479 ST-Vieurtur as the "Destination" with the call below: if (!ColumnEqual(LastSourceRow, SourceRow)) When the comparison function is called, a and b look exactly alike but...
3
1162
by: squrel | last post by:
Hello everyone.. I m having a problem over here and dont knw wht else i have to do... i have 2 listviews (LvBill and LvBillPo) the data from LvBill wil go to the LvBillPo and if its fine then it wil get saved by pressing on the save button and data wil get updated in a table called txpaypo.. bt when i m pressing on save button is giving me thie error "Multiple-Step operation generated errors. check each status value." i have checked...
15
8688
by: squrel | last post by:
Hello All.. I m having some problem here.. i m using VB6 and SQLServer 2000... i m getting this error " statement invalid outside type block" i m sending u the code and the bold line is where i m getting the error can anyone help me.. i dont knw whr i m doing mistake.. thankx in advance Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
16
2337
by: squrel | last post by:
Hello everyone.. I need some help here... i m using VB6 and SQLServer2000... i have forms regarding some cases in courts and in my form i have two DTPicker called as Entrydate and Closedate... these 2 are invisible to the user bt the things is when a user create a new case in a system automatically the date has to be created as a current date by default in DTPentrydate and when the user close the case the date has to be closed automatically...
12
1711
by: squrel | last post by:
Hi everyone.. I have a form called "showreminder". in this form i have 2 dtpicker 1 command button and 1 datagrid : DTPfromDt and DTPtoDt and cmdshowreminder, and MSHFlexGrid1... this form has to connect to one more form which is called as "reminders". in this form i have : txtid,txtcaseid,txtreminder,cmbreminderby,txtremindto,dtpentrydt,dtpclosedt.. when i select the fromdate and todate in my first form and press the commandbutton...
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9587
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7623
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.