2

index.php

<?php
include("header.php");
?>

header.php

<?php
echo"<a href='add.php'>Lägg Till</a>";
?>

result

L?gg Till

The document is utf8 within the head tags and all, it's a php thing, the problem only occurs when i get text from include, i cannot have ÅÄÖ in included php files , how do i make it work?

iPoop
  • 23
  • 1
  • 3

3 Answers3

4

Save these files in utf-8 too

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
2

when sending text to server with accents letters use always ut8_encode, in you case:

echo utf8_encode("<a href='add.php'>Lägg Till</a>");

I have the same problem and this on solves them.

albanx
  • 6,193
  • 9
  • 67
  • 97
0

Besides saving the file in UTF-8 you could also check the "default_charset" configuration in the php.ini file.

pablasso
  • 2,479
  • 2
  • 26
  • 32
  • And check the editor (and if necessary, terminal) are also in UTF-8. It's possible to enter what appears to be UTF-8, but actually isn't. – staticsan Oct 07 '10 at 22:26