In my html.tpl.php file in the <head> tag I display the page title as follows:

<title><?php print $head_title; ?></title>

This displays the foreign characters not correctly when watching the pages in the browser.

I tried to add the <meta charset="utf-8" /> but it didn't help.

Caches were cleared.

What else could you change so that the foreign characters are encoded correctly?

  • Can you give an example string: the expected output and the output you are seeing? Does your browser confirm that your charset is UTF-8? (In Firefox: right-click: page information, opens a popup in which it display the character encoding.) – bgm Oct 26 '14 at 16:29

Instead of trying this.

<?php print $head_title; ?>

try this and check.

<?php print html_entity_decode($head_title); ?>
| improve this answer | |
  • The result is the same. – xralf Oct 26 '14 at 12:06

The form of the meta tag should be, <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

But if what the HTTP-response header says contradicts (check as @bgm suggested), then what is displayed is up to your browser (and sometimes it may depend on the language environment of your OS, for the TITLE tag, though modern OSs are generally good at it). Trying with different browsers may help in some cases.

If you display the same string in a normal content, that may help to confirm it can be displayed correctly in those cases. If not, chances are the chracter-code of the string may be different from what you intended (UTF-8?).

| improve this answer | |

I found the only way was to change the codepage to western Europe

<meta http-equiv="Content-Type" content="text/html; charset="ISO-5591-1" />

this worked for me

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.