0

I have the following function;

function generateFirstName(){
        $firstNameArray = array("Thomáš ","Lukáš ");
        $firstNameKey = mt_rand(0,1);
        $firstName = $firstNameArray[$firstNameKey];
        return $firstName;
    } 

When the function is called on the same page the UTF-8 format outputs fine, but when it is called from a functions.php (that is REQUIRED in the INCLUDED head.php) the UTF-8 format doesn-t arrive and i get the dreaded black diamond with white question mark.

What do I need to do to pass the strings?

EnglishAdam
  • 1,348
  • 1
  • 18
  • 40

2 Answers2

1

Check every required or included files encoding. They all must be in UTF-8 to work together. You have to be sure about every file, that can be included from functions.php and other files.

tanaydin
  • 5,002
  • 26
  • 44
  • 1
    Thx. This problem signals a Programmer error not a PHP issue. I had checked and then on double checking I saw Notepad++ encodes in 2 different places. My bad. Thanks though! – EnglishAdam Apr 27 '15 at 09:36
1

Each file must be encoded in utf8

turbopixel
  • 124
  • 1
  • 10