Re: PHP and AJAX

Anirudh Zala <[email protected]>
Newsgroups gmane.comp.php.internationalization
Message-ID <[email protected]>
On Thursday 12 April 2007 03:35, lazaros wrote:
> I  have this code that sends some information to a php page that searches a
> database and returns the results. The code is:
>
> //showCustomer.js
> ...
>
> var url="showCustomer.php?flag="+flag
> url=url+"&initial="+str
> url=url+"&customer_radio="+customer_radio
> url=url+"&is_prospect="+is_prospect
>
> xmlHttp.onreadystatechange=stateChanged
> xmlHttp.open("GET",url,true)
> xmlHttp.send(null)
> ...
>
> //The php page(showCustomer.php)
> ...
> $initial = $_GET['initial'];
> ...
> $show_customer_query = mysql_query("SELECT * FROM customer WHERE
> customer_name LIKE '$initial%' ORDER BY customer_name");
> ...
>
> In Firefox works perfect both with english and greek.
> But when it comes to IE6 and 7 it works only with english. The $initial var
> is not passed to showCustomer.php properly,so the query fails. If I pass a
> letter α(like a) or σ(like s), $initial is something like this � or a
> square.This happens with all the greek letters.What is the problem?I don't
> mind working only with Firefox(I am working only with it), but what about
> the other users?...
> Everything is UTF8. And the problem appears when I send through GET the
> parameters.
>
> --
> View this message in context:
> http://www.nabble.com/PHP-and-AJAX-tf3562272.html#a9949352 Sent from the
> Php - Internationalization (i18n) mailing list archive at Nabble.com.

You can try following ways.

1: Try to echo (alert) value of "str" before querying using Ajax to make sure 
that JS engine in IE handles it properly before sending back to server.
2: Set default encoding of browser as "utf-8".
3: Try to set character set as "utf-8" in JS if it is possible.
4: Try to use utf_encode() and utf_decode() like functions to encode/decode 
string before sending to PHP.

Let me know what happens, we will test more ways if one or more of these 
doesn't work.

Anirudh Zala

-- 
PHP Unicode & I18N Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.