dirigibleplum
dirigibleplum

Reputation: 137

php - Displaying special characters in a php file

I'm using various European characters (like ø, ą, ñ) in my database, but they are not correctly displayed in my php-file. I've tried some things (below) that I found in simmilar questions, but none of them works.

<head>
  <meta charset="utf-ISO-8859-1">
  ...
</head>


<head>
  <meta charset="utf-8">
  ...
</head>


<?php
header('Content-Type: text/html; charset=ISO-8859-1');
echo "øąñ";
?>

Upvotes: 0

Views: 59

Answers (1)

jurajvt
jurajvt

Reputation: 144

It is correct displayed with <meta charset="utf-8">. If you are trying to get these characters from database, maybe you have not mysql set_charset function used.

$mysqli = new mysqli('localhost', 'user', 'password', 'database');
$mysqli->set_charset('utf8');

Upvotes: 1

Related Questions