Reputation: 2082
How can I get it printed just what is written in code? ışık hğzmesi
is written at code and I want to it printed again as ışık hğzmesi
. What i have tried below about utf-8 coding they haven't work. My code editor set-up is also utf-8.
<?php
$t = 'ışık hğzmesi';
echo utf8_encode($t);
result:ışık hğzmesi
?>
<?php
$t = 'ışık hüzmesi';
echo utf8_decode(($t));
//result:???k hüzmesi
?>
<?php
$t = 'ışık hüzmesi';
echo urlencode($t);
//result:%C4%B1%C5%9F%C4%B1k+h%C3%BCzmesi
?>
<?php
$t = 'ışık hüzmesi';
echo urldecode(urlencode($t));
//result:ışık hüzmesi
?>
Upvotes: 0
Views: 97
Reputation: 13263
Put this as the very first thing in your code:
header('Content-Type: text/html; charset=utf-8');
Upvotes: 0
Reputation: 140210
The physical encoding of the source file is UTF-8, therefore the strings are already UTF-8. Never use utf8_encode
.
<?php
header("Content-Type: text/html; charset=UTF-8");
$t = 'ışık hğzmesi';
echo $t;
Upvotes: 0