0

it was working fine on my old server, but when i shift it on new server, i am facing the probolem.

when i try to fetch Arabic data from the MySQL , i am getting these characters. Ø§Ù„ØµÙØ­Ø© الرئيسية

but when i write the Arabic content directly on my page it shows perfectly.

i already try these, but facing the same problem.

<?php @mysql_query("set global character_set_results=utf8");

@mysql_query("SET NAMES utf8;");

@mysql_query("SET CHARACTER_SET utf8;");?>

Screen Shot of my issue.

2 Answers2

0

Add this in your HTML.

<head>
    <meta charset="utf-8">
</head>
Vivek Pipaliya
  • 488
  • 1
  • 7
  • 17
0

Your mysql settings seems ok. You can use this meta code like:

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

Further check mysql column's character type. character set should be 'utf8'

I hope you already save php file without BOM right? If you aren't, check here.

EDIT: 1. Replace below line with your three line code:

mysql_query("SET character_set_results = 'utf8'");
mysql_query("character_set_client = 'utf8'");
mysql_query("character_set_connection = 'utf8'");
mysql_query("character_set_database = 'utf8'");

2. Set document header:

header("content-type: text/html; charset=utf-8");

like this way:

<?php 
  // Send a raw HTTP header 
  header ('Content-Type: text/html; charset=UTF-8'); 

  // Declare encoding META tag, it causes browser to load the UTF-8 charset before displaying the page. 
  echo '<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />'; 

  // Right to Left issue 
  echo '<body dir="rtl">'; 
?>

You can apply more option as your solution from here. I hope my above explanation solved your issue.

Community
  • 1
  • 1
AddWeb Solution Pvt Ltd
  • 21,025
  • 5
  • 26
  • 57