« AJAX Page Links Checker | Main | AJAX Live Archive, a textpattern plugin »

AjaxAC and Middle Eastern encoding

AjaxAC is an open-source framework written in PHP, used to develop/create/generate AJAX applications. I've noticed many problems concerning AjaxAC and Middle Eastern encoding, it will be also valid for Unicode and East-Asian encoding too. The first thing is in the AjaxACApplication.class.php function sendResponseData(), you can see in the end of the function :

This will never work with Middle Eastern encoding like windows-1256. First there is no need to set Content-length, and then we should have something like that :

So to do something general, we can use the _defaultCharset parameter in the beginning and set it to the charset that we need. So if you got Javascript error just replace the default charset ( UTF-8 ) with your current charset :

Now you can try sample code like GoogleSuggestCloneJax and retrieve data in arabic using AjaxAC just change in GoogleSuggestCloneJax.class.php the getSuggestions() function with this one

That's all folks, happy coding !

PS : There is no space in the last regular expression

Update : There is still another thing that I forget to add :

  • encodeURIComponent() doesnt support all encoding, so just open AjaxACWidgetXMLHttpRequest.class.php and remove all encodeURIComponent() calls
  • There is another test to be removed in googlesuggestclone.js which is the regular expression the function will be And then you can remove the var gsc_basicmatch.
  • Bookmark this article at these sites
    Comments
    1

    Thank you very much, I was really searching for this one :)

    Is their any way I can contact Hatem, I would love to have him as a friend on my MSN list :)

    I think he is arabic guy like me who love to programmere.

    2

    please sir,

    i just want a very simple application using the AjaxAC, i am a php beginner and i can't trace and understand all this google suggest application.

    could you please put a sample for just sending and text and recieving another.

    thanks for your help

    Mohamed Barakat

    Post a comment





    (Email will remain hidden)





    Please enter the security code you see here




    Related entries
    Email to a friend
    Email this article to:


    Your email address:


    Message (optional):