Akkari Posted February 24, 2011 Share Posted February 24, 2011 Hey there everyone. Today isn't my lucky day since I'm dealing with international characters. (Arabic). What happens is the following: Arabic entered in form > saved to MySQL > Retrieved from MySQL > outputted as XML > used in an application (Google maps if it makes any difference). Plain and simple, the problem is that the final output is this: %u0645%u0639%u0644%u0645 which definetly isn't arabic. What I've tried so far: - Loading the Google Maps thing directly from XML which I manually created and put the arabic chars into -> WORKED! (meaning I cut out the saving and retrieval of info from the db to see where the problem may be coming from) - Set the database collation and charset to utf8_unicode_ci. (Also collation of the fields inside the table) -> NO LUCK! - Tried encoding all PHP files and html files involved in the process to UTF-8 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -> NO LUCK! - Tried a suggestion from Google which said try to execute this query after connection with the db: mysql_query("SET NAMES 'utf8'"); mysql_query('SET CHARACTER SET utf8'); -> still no luck First time I get that frustrated. I guess the problem isn't with Gmaps and XML. Something to do with PHP & MySQL because when the raw XML files displays correctly, Gmaps works like a charm. And the only way I got the XML file to show correctly as said earlier was to manually create it and enter the arabic text in it. Thanks a lot for any help provided! Quote Link to comment https://forums.phpfreaks.com/topic/228693-utf-8-is-killing-me-please-help/ Share on other sites More sharing options...
xangelo Posted February 24, 2011 Share Posted February 24, 2011 If you dump the data in PHP before you put in the database is the data still being mangled? Or does that only happen when it's inserted? Quote Link to comment https://forums.phpfreaks.com/topic/228693-utf-8-is-killing-me-please-help/#findComment-1179131 Share on other sites More sharing options...
Akkari Posted February 27, 2011 Author Share Posted February 27, 2011 Thanks for your eye opening response and sorry for the late reply. Actually when dumped in PHP it works. However, I think I should add a very important point. The arabic data is gathered through a form and processed through a $_GET. Meaning PHP receives the data from a URL. So all my concentration now is how to decode this: %u064A%u0627%u0633%u064A%u0646 which seemingly is how "arabic" looks in a URL. Thanks a lot. Quote Link to comment https://forums.phpfreaks.com/topic/228693-utf-8-is-killing-me-please-help/#findComment-1180527 Share on other sites More sharing options...
Akkari Posted February 27, 2011 Author Share Posted February 27, 2011 SOLVED! A separate issue has arised so I'm gonna open a new thread. All I simply needed was to use the javascript's unescape(). By the way, I cannot find the mark as solved button. Is it something on my side? Quote Link to comment https://forums.phpfreaks.com/topic/228693-utf-8-is-killing-me-please-help/#findComment-1180543 Share on other sites More sharing options...
chaseman Posted February 27, 2011 Share Posted February 27, 2011 Quote By the way, I cannot find the mark as solved button. Is it something on my side? The forum has gotten an update, since then the button is gone. I miss that button... On the top left is also a new logo. Quote Link to comment https://forums.phpfreaks.com/topic/228693-utf-8-is-killing-me-please-help/#findComment-1180544 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.