0

Hi
I Love daniweb for web solution. I want to make a website using jquery. I want to use jquer POST method for my site.
My sample code is

  $.post("search.php",{word:"good"},function(result){
    $("#content").html(result);

Here the word 'good' will be search in a database using search.php by POST method. I already did that and its working fine.
Problem is that when result is Unicode. Its showing ????????????????? character instead of real UTF-8 character.
My html files top r as below

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta content="EN" http-equiv="Content-Language">
<meta content="UTF-8" name="Charset">

Can u plz suggest me what should I do?
thanks

2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by hr.Ziggurat
0

use from json_encode to convert each character to a hex code word.
ie:

<script type="text/javascript">
<?php
$f = json_encode("a utf-8 text");
$f = str_replace("\\","%",$f);
$f = str_replace("\"","",$f);
echo "alert(unescape(\"$f\"))";  // convert to normal characters
?>
</script>

Edited by hr.Ziggurat

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.