RE: FRench characters not displayed correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




-----Original Message-----
From: Ford, Mike [mailto:M.Ford@xxxxxxxxxxxxxx] 
Sent: 17 April 2008 12:25
To: php-general@xxxxxxxxxxxxx
Subject: RE:  FRench characters not displayed correctly

On 17 April 2008 10:05, Robert Cummings advised:

> On Thu, 2008-04-17 at 10:57 +0200, Angelo Zanetti wrote:
>> 
>> Thanks Robert,
>> 
>> I have the following headers:
>> 
>> 
>> http://fr.xxxx.com/student/themes/english/locker_room/student.html
>> 
>> GET /student/themes/english/locker_room/student.html? HTTP/1.1 Host:
>> fr.xxxx.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US;
>> rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
>> 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-us,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
>> Referer:
> http://fr.xxxx.com/student/themes/english/locker_room/student.html
>> Cookie: PHPSESSID=818678404c170c8e4f5d237c1d0280a8
>> If-Modified-Since: Sat, 17 Nov 2007 11:40:26 GMT
>> If-None-Match: "6b97e-a9d-619b9e80"
>> Cache-Control: max-age=0
>> 
>> HTTP/1.x 304 Not Modified
>> Date: Thu, 17 Apr 2008 08:31:32 GMT
>> Server: Apache/2.0.55 (Unix) PHP/5.1.2
>> Connection: Keep-Alive
>> Keep-Alive: timeout=15, max=200
>> Etag: "6b97e-a9d-619b9e80"
>> -----------------------------
>> 
>> 
>> Now I see that the headers have:
>> 
>> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
>> 
>> Which to me seems like it is sending both ISO-8859-1 and UTF-8?
> 
> No, that's what kind of content the server is willing to accept from
> various sources such as POST.

Er, no, that's what kind of content the browser is prepared to accept
back from the server -- the headers starting from the GET line are what
the browser sends to the server as part of the request.  The lines
starting at the HTTP/1.x line are what the server returns.

In this case, you're getting a 304 Not Modified, which means the server
is not even serving any content on this request, nor, probably, even a
full set of headers -- it's just telling the browser it can use its
cached page.  To be absolutely sure what the relevant headers are, you
need to force the server to send the full page -- usually, the best way
to do this is to hold down the Ctrl key whilst clicking the
Refresh/Reload button.

Incidentally, I notice that what's being served here is a .html page,
and the presence of a 304 response, and no PHP headers, suggests it
actually is plain HTML, and not a disguised script, so this whole thread
is really very OT...!! ;)  However, this being the case, it suggests you
have a static .html file on your site claiming to be charset=utf-8, but
not saved in UTF-8!  There are two obvious ways to solve this: (i)
convert the file into UTF-8, or (ii) edit it to have the correct
charset= value in the tag.
----------------------



Mike, thanks very much I have done a ctrl+F5

And have the following: 

----------------------------------------------------------
http://fr.xxxxx.com/student/themes/english/locker_room/student.html

GET /student/themes/english/locker_room/student.html HTTP/1.1
Host: fr.xxxxx.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14)
Gecko/20080404 Firefox/2.0.0.14
Accept: image/png,*/*;q=0.5
Accept-Language: en-us,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
Referer:
http://fr.xxxxxx.com/student/themes/english/locker_room/student.html
Cookie: PHPSESSID=5d5af707c9c34205d30708326872ad27
Pragma: no-cache
Cache-Control: no-cache

HTTP/1.x 200 OK
Date: Thu, 24 Apr 2008 08:34:10 GMT
Server: Apache/2.0.55 (Unix) PHP/5.1.2
Last-Modified: Sat, 17 Nov 2007 11:40:26 GMT
Etag: "6b97e-a9d-619b9e80"
Accept-Ranges: bytes
Content-Length: 2717
Keep-Alive: timeout=15, max=198
Connection: Keep-Alive
Content-Type: text/html

I can now see that the response is a 200 OK response.

So basically to get these pages to serve the French characters correctly
would I need to do the following: 

(i)  convert the file into UTF-8, or 

(ii) edit it to have the correct charset= value in the tag. 

	When you refer to charset are you referring to: iso-8859-1 or UTF-8?

(iii) Also would I need to send the PHP headers as follows: 

	header( 'Content-type: text/html; charset=iso-8859-1' ); 

(iv) Also does the fact that there is no <DOCTYPE> declaration have any
impact on the showing of the French characters?


Anyone who feels like that are able to comment on the above please assist,
as it is greatly appreciated.

Thanks
Angelo


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux