Jump to content

UTF-8 is Killing me. Please help.


Akkari

Recommended Posts

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.