I have a complete web application, all the pages are fine, saved as UTF-8 files and contain UTF-8 META tag value... the problem resides in the "cpanel.php" page, everything before and everything after is displayed correctly and if I right click and go to encoding it is => UTF-8 which is right...

but in the "cpanel.php" page, although it is saved as UTF-8 file, and contains the UTF-8 META tag value... when I "first" arrive to it, it is not displayed correctly ( in arabic ), in symbos instead, and the encoding is just "windows", but when I refresh the page, everything is fine then, Arabic Contents & UTF-8 encoding...

So what's the problem ? why does this page specifically show me wrong contents ? how can it be UTF-8 from the first visit ? ( note that it is saved as UTF-8 file, contains UTF-8 as meta tag value, and plus a session starts before it; in the logging in process page... )

Any help would be appreciated 🙂

    5 days later

    Looks to me like a page loading issue in the browser.
    Just a guess:
    Try to place the UTF-8 meta definition as early as possible in the HTML head. I remember having read this hint somewhere else.

      So nothing changes, you simply refresh the same page and Unicode characters are instantly displayed correctly? That seems... odd, to say the least.

      You could do one step better than the above suggestion, possibly; if PHP was configured as an Apache module on your server (e.g. you can change PHP directives in a .htaccess file), you could place the following in a .htaccess file to have PHP automatically send out the "charset=utf-8" HTTP header for all pages:

      php_value default_charset "utf-8"

      If .htaccess isn't an option, most hosts usually offer a way for you to provide the PHP parser with your own php.ini file to modify directives. Alternatively, you could accomplish the same by using [man]ini_set/man at the top of the PHP scripts.

        Write a Reply...