-1
var $link = $("#frametest").contents().find(".eod-topbox").find('a');
var variable2= $("#frametest").contents().find(".eod-topbox").find("h3").find(".hidetitle").html();
var variable1= $link.attr('href');
$.post('insert.php', {variable1: link_address, variable2: heading},
function(data){$("#message").html(data);});
alert(variable2);
alert(variable1);

In this script, alert are showing hindi text properly and showing link also. But when I try to save this variable2 to the database, it saves something like this

कांगà¥à¤°à¥‡à¤¸ से बढ़ती AA...

in the message div hindi text is displaying properly and when I just copy hindi text to database manually there is no problem. Please help somebody.

Kallewallex
  • 523
  • 1
  • 6
  • 24

2 Answers2

1

Your database column Collation should be utf8_unicode_ci

and place this code top of the PHP page

mysqli_set_charset ($con, "utf8");

and place

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

in your html header

user1844933
  • 3,296
  • 2
  • 25
  • 42
-1

That's what I usually do in my connection file:

$db = new mysqli($db_host, $db_user, $db_pass, $db_name);

if ($db->connect_errno) {

    printf("Connect failed: %s\n", $db->connect_error);
    exit();
}

$db->query("set names 'utf8'");
MrUpsidown
  • 21,592
  • 15
  • 77
  • 131