Problems with AJAX encoding?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Birokrat
Forum Newbie
Posts: 2
Joined: Mon Feb 02, 2009 1:00 pm

Problems with AJAX encoding?

Post by Birokrat »

The php script returning the resultset is:

Code: Select all

$result = mysql_query($sql);
 
while($row=mysql_fetch_array($result))
{
echo "The cyrilic text: <b style="color:#BAB918;">'.$row['TYPE'].'</b>"
}
When I use header('Content-Type: text/xml; charset=windows-1251') the data pulled from the databse using the utf8_unicode_ci has been replaced with some random characters and the cyrilic text embedded in the echo function is displayed fine.
but when i set header to header('Content-Type: text/xml; charset=utf-8')
I get the reverse effect the data pulled from the databse is correct and the cyrilic text is replaced with questionmarks.
Sorry for my English.

Regards.
Post Reply