Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
| Search | Today's Posts | Mark Forums Read
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 15th, 2007, 04:44 PM
Registered User
 
Join Date: Nov 2007
Location: riyadh, riyadh, Saudi Arabia.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to farukcse
Default encoding problem with arabic character

Dear Sir,
i am facing a problem with encoding for arabic characters.
here is the code:
1.test.html
<html>
<body>

<script type="text/javascript">
var AJAX = {
  initialize: function(){
    var xmlHTTP;
    try{xmlHTTP = new XMLHttpRequest();}
    catch(e){
      try{xmlHTTP = new ActiveXObject("Msxml2.XMLHTTP");}
      catch(e){
        try{xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");}
        catch(e){
          alert("Your browser does not support AJAX!");
          return false;
        }
      }
    }
    return xmlHTTP;
  },

  get: function(url, func){
    var obj = this.initialize();
    obj.open('GET', url, true);
    obj.send(null);
    obj.onreadystatechange = function(){
      if(obj.readyState == 4){
        func(obj.responseText);
      }
    }
  }
}

function getUpdate(txt){
  document.getElementById('getReturn').innerHTML = txt;
}
</script>

<input type="text" id="test" name="test" value="blah" onkeyup="AJAX.get('test.php?x=' + this.value, getUpdate)" />
<div id="getReturn"></div>


</body>
</html>

2.test.php
<?php
header('Content-Type: text/html; charset=utf-8');

echo $_GET['x'];
?>

...
if i put english character then there is no problem.
ie. input: f f f output: f f f
but if i put arabic character then i got error.
i.einput: #213; #213; #213;
output:? ? ?

so can anyone tell me how to solve this problem?

Regards,
Faruk Chowdhury


Similar Threads
Thread Thread Starter Forum Replies Last Post
Invalid Character in the given encoding mswin XSLT 3 November 28th, 2008 06:01 AM
arabic problem rimalolo ASP.NET 2.0 Basics 0 May 11th, 2006 06:07 AM
Arabic problem asifshaikh VB How-To 1 February 19th, 2006 09:27 PM
How can i display the Arabic character Muhammad Arif BOOK: Beginning Visual C++ 6 1 March 25th, 2005 06:39 AM
How can i display arabic character in vc++.6 Muhammad Arif Visual C++ 1 April 20th, 2004 01:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.