Sending Arabic data to database by jQuery
<p>I have a text box named "rep" that sends Arabic data to a PHP file using jQuery. The problem is that the database encoding is <code>latin1_swedish_ci</code>, not UTF8 and I cannot change it because it'll cause a problem in viewing the previous data.</p>

<p>Here is my code:</p>

<pre><code>&lt;SCRIPT LANGUAGE="JavaScript"&gt;
$(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);
  });
        });
    });
});
&lt;/SCRIPT&gt;
</code></pre>

<p>Here is my PHP file:</p>

<pre><code>&lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" /&gt;
&lt;?php
include "config.php";

if($_POST["rep"]){
$rep = $_POST["rep"];
$id = $_POST["id"];
$mysqltable="items";

    $q = mysql_query("UPDATE " . $mysqltable . " SET rep='".$rep."' WHERE id=".$id);
(".$id.",'".$rep."')");

    echo ($q)? "done ".$_POST["rep"] : 'failed';

}
</code></pre>

<p>I want to save the sent value to the database but I found it saved in strange letters 
please advice how to use the correct encoding.</p>