Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

On a website I use language files that look like this:

<?php
header('Content-Type: text/html; charset=utf-8');

function lang($phrase){
    static $lang = array(

        //MENU-TOP
        'PHRASE_1' => 'Kezdőlap'

    );

    return $lang[$phrase];
}

?>

and call the right translation on the website with

<?php echo lang('PHRASE_1'); ?>

The website I call the translation from is in UTF-8, and other phrases that come from the database are being displayed correctly. However, the phrases from the language file are corrupt (? characters etc).

Anyone any idea how to solve this?

share|improve this question
4  
Then your language file isn't encoded properly. Check your "Save as" dialog, that's where the setting often is – Pekka 웃 Feb 22 at 18:34
@Pekka웃: hey, thx so much, this was the solution. Could you submit an answer so I can accept it? – Chris Feb 22 at 18:37
What is the downvote for? – Chris Feb 22 at 18:37

1 Answer

up vote 3 down vote accepted

Then your language file isn't encoded properly.

Check your "Save as" dialog, that's where the setting is in most IDEs and text editors.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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