php - Sending Arabic data to database by jQuery -


i have text box named "rep" sends arabic data php file using jquery. problem database encoding latin1_swedish_ci, not utf8 , cannot change because it'll cause problem in viewing previous data.

here code:

<script language="javascript"> $(function() { $("input[name='rep']").each(function(i) {     $(this).change(function($mainelement) {             var rep_name = $(this).val();             var item_id = $(this).attr('id'); var request = $.ajax({   method: "post",   url: "inc/rep.php",   data: { rep: rep_name, id: item_id } }); request.done(function( msg ) {                 $('#dd').html(msg);   });         });     }); }); </script> 

here php file:

<meta http-equiv="content-type" content="text/html; charset=iso-8859-15" /> <?php include "config.php";  if($_post["rep"]){ $rep = $_post["rep"]; $id = $_post["id"]; $mysqltable="items";      $q = mysql_query("update " . $mysqltable . " set rep='".$rep."' id=".$id); (".$id.",'".$rep."')");      echo ($q)? "done ".$_post["rep"] : 'failed';  } 

i want save sent value database found saved in strange letters please advice how use correct encoding.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -