Felipe
Felipe

Reputation: 11887

Differing outputs depending on where one is accessing a page from?

I'm having a weird problem regarding PHP and charset encoding..

I am developing a PHP Page that outputs some latin (ã, á, à, and so on) characters.

When I run the page from my localhost, it works just fine. However, when I upload it to my test-server and access it via a url, then all latin characters become little squares (in IE by the way).

I've changed the character encoding on my browser back and forth to utf8, western european and so on, but none seem to work

Does anybody have an idea?

Upvotes: 0

Views: 40

Answers (3)

BalusC
BalusC

Reputation: 1108712

Either set the default_charset in php.ini to UTF-8, or if you don't have the control over this, add the following line to the top of the PHP file, before you emit any character to the response body:

header('Content-Type: text/html;charset=UTF-8');

See also:

Upvotes: 1

Nev Stokes
Nev Stokes

Reputation: 9779

Have you checked for different default_charset settings in the php.ini files of your localhost and your test server?

Upvotes: 1

Robus
Robus

Reputation: 8259

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> // Or actual encoding
</head>

Upvotes: 0

Related Questions