Manhag Posted November 23, 2012 Share Posted November 23, 2012 i used this example to create a submit form to database http://www.simonerodriguez.com/form-submit-in-ajax-script-per-principianti.html input in arabic like مصر the output appears like %u0645%u0635%u0631||%u0645%u0635%u0631||%u0628%u062F%u0648%u0646 %u0635%u0648%u06 how can i enable arabic in ajax Quote Link to comment https://forums.phpfreaks.com/topic/271085-php-with-ajax-arabic/ Share on other sites More sharing options...
mrMarcus Posted November 23, 2012 Share Posted November 23, 2012 (edited) i used this example to create a submit form to database http://www.simonerod...incipianti.html input in arabic like مصر the output appears like مصر||مصر||بدون صو how can i enable arabic in ajax By "the output" do you mean once it's outputted back to the screen from the database? Or that's how it's showing in the database? What is your table collation? What charset encoding are you using within your application? EDIT: Also, are you specifying a Content-Type (contentType in jQuery) during the AJAX processing? In jQuery, the default is UTF-8. Edited November 23, 2012 by mrMarcus Quote Link to comment https://forums.phpfreaks.com/topic/271085-php-with-ajax-arabic/#findComment-1394668 Share on other sites More sharing options...
Manhag Posted November 23, 2012 Author Share Posted November 23, 2012 output before storing in database Quote Link to comment https://forums.phpfreaks.com/topic/271085-php-with-ajax-arabic/#findComment-1394669 Share on other sites More sharing options...
mrMarcus Posted November 23, 2012 Share Posted November 23, 2012 output before storing in database I don't follow. So, when you're typing into the form? Your process should be as follows: 1. enter data (Arabic) into form, 2. submit form; AJAX call ensues, 3. data is sent for processing and inserted into database. At what stage are you experiencing the issue with encoding? Quote Link to comment https://forums.phpfreaks.com/topic/271085-php-with-ajax-arabic/#findComment-1394670 Share on other sites More sharing options...
Manhag Posted November 23, 2012 Author Share Posted November 23, 2012 (edited) when i click submit a message appears that it is done + data sent %u 06 45 %u 06 35 %u 06 31 remove space bet characters Edited November 23, 2012 by Manhag Quote Link to comment https://forums.phpfreaks.com/topic/271085-php-with-ajax-arabic/#findComment-1394672 Share on other sites More sharing options...
Manhag Posted November 24, 2012 Author Share Posted November 24, 2012 i goggled it and found this answer it fixed my problem may help any one $string = preg_replace('/%u([0-9A-F]+)/', '$1;',$string); $string =html_entity_decode($string, ENT_COMPAT, 'UTF-8'); Quote Link to comment https://forums.phpfreaks.com/topic/271085-php-with-ajax-arabic/#findComment-1394690 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.