Confidence Posted May 20, 2011 Share Posted May 20, 2011 hi, i made my own page, but when i do an insert using mysql, jquery and php, the arabic text does not show properly it is a comments page. here is the DB structure CREATE TABLE IF NOT EXISTS `app_comments` ( `comment_id` int(20) NOT NULL auto_increment, `comment` text NOT NULL, `user_id` int(20) NOT NULL, `comment_date` date NOT NULL, `app_id` int(20) NOT NULL, PRIMARY KEY (`comment_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=35 ; here is the jquery piece that transfers to php code. function submit_comment(){ $(".post_comments_button").click(function() { var post_comments = $('.post_comments').val(); var app_id = $('#app_id').val(); //alert (app_id); if(confirm('Add Comment?')) { var string = "task=add_comment&app_id=" + app_id + "&comment="+post_comments; $.ajax({ url : "appajax.php", type : "POST", data : string, success : function(data) { alert(data); window.location.reload(true); } }); } /**/ }); } and here is the acutal insert code in php $new_appquery = 'INSERT INTO app_comments (comment, user_id, app_id,comment_date) VALUES ("' . $comment . '",' . $user_id . ', ' . $app_id . ',NOW());'; and the actual problem is, the arabic text shows like this in my application: بالتوÙيق للريال how can i solve this issue? Link to comment https://forums.phpfreaks.com/topic/236934-phpmysqljquery-and-arabic-text-inserts/ Share on other sites More sharing options...
dreamwest Posted May 20, 2011 Share Posted May 20, 2011 Change collation to utf8_bin Link to comment https://forums.phpfreaks.com/topic/236934-phpmysqljquery-and-arabic-text-inserts/#findComment-1217919 Share on other sites More sharing options...
dreamwest Posted May 20, 2011 Share Posted May 20, 2011 and also put this at the top of your HTML page <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> Link to comment https://forums.phpfreaks.com/topic/236934-phpmysqljquery-and-arabic-text-inserts/#findComment-1217922 Share on other sites More sharing options...
Confidence Posted May 20, 2011 Author Share Posted May 20, 2011 thanks, works like a charme Link to comment https://forums.phpfreaks.com/topic/236934-phpmysqljquery-and-arabic-text-inserts/#findComment-1217930 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.