spirelli — 2011-12-19T06:30:40-05:00 — #1
I'm using PHP inludes to include content on the page which stays the same, e.g.
<?php include("_site-footer.php"); ?>
My page have this tag in the head (also added with 'php include')
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Special characters display fine if the text is directly on the page. However, if there is any included text the characters don't display, e.g.
Vilkår comes out as Vilk�r, and so on.
I have no idea what to do, so thank you for any help.
P.S. My pages are in Norwegian with some English. Should I set the encoding to something different than UTF-8? Also, I only need to get it to work on my local machine for now – so no need to fiddle with settings on a hosting account. Just need to get it to work with PHP on my Mac.
cups — 2011-12-19T06:54:22-05:00 — #2
If you load sitefooter.php DIRECTLY into your browser, are you saying it displays correctly?
If that is the case the problems could be, as you imagined, the html encoding tag, you'd need to discover what the file itself is encoded as (some kind of iso_* perhaps?).
What happens if you don't encode as utf-8?
For me what generally works is this: In order to get your calling script and base include file using the exact same encoding then open them up in an IDE (NetBeans or similar) and reset the encoding. There are some text editors which will also do this for you (Vim).
This is usually the case with language files that have come from somewhere else, or you have copy/pasted the text from somewhere else -- I find this a very common occurrence.
These are wild stabs in the dark and if they don't do it for you then bone up on encoding by reading what this guy has to say kore nordman.
spirelli — 2011-12-19T11:57:50-05:00 — #3
Thanks for your reply. I did get it to work by just pasting plain text into a new Dreamweaver file. Many thanks for your reply and encouraging me just to try.