2

I have the below string (in Turkish):

$string = "Otpor lideri Maroviç: Gezi eylemcileriyle temasımız olmadı";

However, when I attempt to echo the string, I get the below result:

Otpor lideri Maroviç: Gezi eylemcileriyle temas?m?z olmad?

How can I solve this problem?

Chris Forrence
  • 10,042
  • 11
  • 48
  • 64
Nikul
  • 1,025
  • 1
  • 13
  • 33

3 Answers3

2

First of all:

$string = "Otpor lideri Maroviç: Gezi eylemcileriyle temasımız olmadı";
echo htmlentities($string);

And make sure to add... to your head

<meta charset="UTF-8">
AwesomeGuy
  • 573
  • 3
  • 14
2
header('Content-type: text/plain; charset=utf-8');
$string = "Otpor lideri Maroviç: Gezi eylemcileriyle temasımız olmadı";
echo $string;
fortune
  • 3,361
  • 1
  • 20
  • 30
1

Open your file with code editor ex. Notepad++ and use "Convert to UTF-8" function. This should help. Here in Poland we are also using special characters and this is a common problem.

Tikky
  • 1,253
  • 2
  • 17
  • 36