Forum Moderators: coopster

Message Too Old, No Replies

Simple PHP character set question

         

aslong

9:44 am on Sep 10, 2005 (gmt 0)

10+ Year Member



I'm trying to get a php file to display Danish characters.

This code


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
Ø
</body>
</html>

in a .html file works fine.

in a .php file the Ø is corrupted.

There's no actual PHP code in the file, so it's just a matter of the PHP parser changing it. My default charset in php.ini is set up correctly.

What do i need to do?

Thanks

Russell.

ergophobe

3:41 pm on Sep 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That's strange. I suspect it's a server setup issue where the server sends one set of headers for html and another for what's running through the PHP processor and they conflict.

Did you look to see what headers the server sends in both cases? Firefox "live headers" (or something like that) extension will tell you what's being sent.

aslong

3:52 pm on Sep 10, 2005 (gmt 0)

10+ Year Member



with .html extension


http://www.example.co.uk/new/test.html
GET /new/test.html HTTP/1.1
Host: www.example.co.uk
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.7.10) Gecko/20050717 Firefox/1.0.6
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
HTTP/1.x 200 OK
Date: Sat, 10 Sep 2005 15:54:36 GMT
Server: Apache/2.0.50 (Fedora)
Last-Modified: Sat, 10 Sep 2005 15:54:28 GMT
Etag: "616c142-ef-e8bcd500"
Accept-Ranges: bytes
Content-Length: 239
Connection: close
Content-Type: text/html; charset=WINDOWS-1251

with .php extension


http://www.example.co.uk/new/test.php
GET /new/test.php HTTP/1.1
Host: www.example.co.uk
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.7.10) Gecko/20050717 Firefox/1.0.6
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
HTTP/1.x 200 OK
Date: Sat, 10 Sep 2005 15:54:50 GMT
Server: Apache/2.0.50 (Fedora)
X-Powered-By: PHP/4.3.10
Content-Length: 239
Connection: close
Content-Type: text/html; charset=WINDOWS-1251

[edited by: jatar_k at 7:48 pm (utc) on Sep. 10, 2005]
[edit reason] examplified [/edit]

aslong

3:56 pm on Sep 10, 2005 (gmt 0)

10+ Year Member



i take it back.. it does the same if it's either a .html or a .php extension.

it's when i just load the .html into a browser locally that it works.

ergophobe

7:28 pm on Sep 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Content-Type: text/html; charset=WINDOWS-1251

When you look at View -> character encoding in your browser, what encoding is it using? The server is saying it's Win 1251, which is Cyrillic