Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Javascript/jquery messes up special characters Re: Javascript/jquery messes up special characters

#91826
lulli240
Member

I have the meta tags on both the pages. The javascript messes the string up but I managed to solve it like this.

$(document).ready(function(){
//If user submits the form
$("#submitmsg").click(function(){
var clientmsg = $("#usermsg").val();
var e_clientmsg = escape(clientmsg); //escape the string
$.post("post.php", {text: e_clientmsg});
$("#usermsg").attr("value", "");
return false;
});
});

require("_config.php");
$address = $_SERVER;
$err = array();
$message = urldecode($_POST); // Decode the string
$mem_id = $_COOKIE;
$ip = $address;
$result = mysql_query( "Insert Into chat (user_id, message, ip) Values('$mem_id', '$message', '$ip')",$conn )
or die("Something went wrong while inserting message into database !". mysql_error());
?>

And now all my Icelandic characters shows up fine.

Thanks for your answer though Mottie ;)