0

enter image description here

From the above image im getting ? symbols in option in database there is a chareter present how can i resolve this issue..

I have a header like this

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

And i am looking for permanent solution this is my code:

and when print the variable it is coming like this:console.log(getContact);

enter image description here

    function get_question_detail(q_id){
    $("#all_option").html("");
    var temp_ques = sessionStorage.getItem(q_id);
    if (temp_ques){
    var getContact = JSON.parse(temp_ques);

    for (var j = 1; j <= ans_option_count; j++) {
    var temp_var = "sr_no" + j;
    var full_div = '<div class="answer_option"><input type="radio" name="ans_option" value="' + j + '"  class="validate[required]"  />&nbsp;&nbsp;&nbsp;' + getContact['option'][temp_var] + '';
    $("#all_option").append(full_div);
    // console.log(full_div);
    }
Mr world wide
  • 4,696
  • 7
  • 43
  • 97
  • i think this content is copy paste content, remove the actual content shown in "?" then retype it. – Alfin Paul Apr 12 '17 at 06:24
  • 1-Use one header (UTF-8 is best). 2-Be sure that your file is saving UTF-8 without bom. 3-If these questions coming from mysql then be sure you executed "SET NAMES utf8" sql command. – kodmanyagha Apr 12 '17 at 06:26
  • @kodmanyagha can you tell me how can i set in sql. `$conn = new mysqli(DBHOST, DBUSER, DBPASSWORD, DBNAME); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); }` – Mr world wide Apr 12 '17 at 06:31
  • After connection execute this command. If you use mysqli you can call that: mysqli_query("set names utf8"); – kodmanyagha Apr 12 '17 at 06:33
  • @kodmanyagha i have tried this way but not working: `if ($conn){ mysqli_query("set names utf8"); }` – Mr world wide Apr 12 '17 at 06:46

0 Answers0