Andy17 Posted April 29, 2011 Share Posted April 29, 2011 Hey guys, Firstly, this is not solely about PHP, but rather a mixture of jQuery, JSON, PHP and MySQL, but I hope it's OK to post it here. I am sending data to a PHP script via the jQuery ajax function. The data is encoded in JSON and then decoded in the PHP script. This all works great. However, I noticed that one of my queries does not work with certain characters in the data (more specifically the Danish characters æ, ø and å). The query works with other data except those. The query also works if I hard code the data into the PHP script, even if it contains any of the three mentioned characters. This leads me to believe that the problem is somehow connected to character sets when sending data from one page to my PHP script with jQuery. The page from which the data is sent to the PHP script has a charset of iso-8859-1 and the columns utf8_danish_ci. I can indeed see that those are not the same, but I have tried to use the PHP uft8_encode() function in my PHP script, but without luck. I have not posted any code because I don't really find this relevant in relation to my problem. Can anyone think of a way to solve this without changing charset on the page from which the data is sent from (to the PHP script)? Thanks in advance, Andy Quote Link to comment https://forums.phpfreaks.com/topic/235128-charset-trouble/ Share on other sites More sharing options...
andy39 Posted April 30, 2011 Share Posted April 30, 2011 Bump. Quote Link to comment https://forums.phpfreaks.com/topic/235128-charset-trouble/#findComment-1208597 Share on other sites More sharing options...
andy39 Posted May 2, 2011 Share Posted May 2, 2011 Bump. Quote Link to comment https://forums.phpfreaks.com/topic/235128-charset-trouble/#findComment-1209349 Share on other sites More sharing options...
andy39 Posted May 8, 2011 Share Posted May 8, 2011 Bump. Quote Link to comment https://forums.phpfreaks.com/topic/235128-charset-trouble/#findComment-1212399 Share on other sites More sharing options...
PFMaBiSmAd Posted May 8, 2011 Share Posted May 8, 2011 Is there some reason you are bumping a thread for Andy17? Quote Link to comment https://forums.phpfreaks.com/topic/235128-charset-trouble/#findComment-1212406 Share on other sites More sharing options...
silkfire Posted May 8, 2011 Share Posted May 8, 2011 Yes, you have to utf8_encode the string before you json_encode it. Quote Link to comment https://forums.phpfreaks.com/topic/235128-charset-trouble/#findComment-1212427 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.