Re: [PHP] Re: Internet Explorer doesn't display UTF-8 page using UTF-8 encoding
At 7:42 PM -0500 8/14/06, Richard Lynch wrote: What a mess MS makes of things! Except sales. tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Internet Explorer doesn't display UTF-8 page using UTF-8 encoding
On Sun, August 13, 2006 1:43 pm, Rasmus Lerdorf wrote: > tedd wrote: >> At 6:48 PM -0700 8/12/06, Rasmus Lerdorf wrote: >>> By the way, everyone should be setting a charset. If you don't set >>> it, IE will look at the first 4k of the body of the page and take a >>> wild guess. >>> >>> -Rasmus >> >> -Rasmus: >> >> Ok, but why doesn't w3c use it? >> >> http://validator.w3.org (check source) >> >> I'm not sure what to do re charset. I've been told by credible >> sources >> to "always use it" and "never use it" -- which is correct? Or, is >> this >> one of those "it depends" things? > > W3C is all about standards. IE is all about not following standards. > If you want your site to work in the real world you should always set > a > charset. If you set it in your response header there is no need to > set > it in each page, and if you look closely, you will see that this is > what > w3.org is doing: > > 9:55am shiny:~> telnet validator.w3.org 80 > Trying 133.27.228.132... > Connected to validator.w3.org. > Escape character is '^]'. > HEAD / HTTP/1.0 > > HTTP/1.1 200 OK > Date: Sun, 13 Aug 2006 18:42:15 GMT > Server: Apache/2.0.54 (Debian GNU/Linux) mod_perl/1.999.21 Perl/v5.8.4 > Accept-Ranges: bytes > Connection: close > Content-Type: text/html; charset=utf-8 If you want it to actually WORK in IE, you need both header() and META tag... At least in my limited testing so far under UTF-8 and Transition DOCTYPE. YMMV This is no guarantee that IE will work under any other DOCTYPEs, nor in any other versions of IE. Only that I know that's what it took for the current version of IE I was using a month or two ago. It would be interesting if somebody who understood charsets MUCH better than I were to test all the combinations of: IE version X header/meta charset Xmany charsets and see just how many of them actually work, and how many of them open up IE to XSS attacks... What a mess MS makes of things! -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Internet Explorer doesn't display UTF-8 page using UTF-8 encoding
My current theory is that IE needs BOTH header() and META charset to agree before it will believe you. :-) On Sat, August 12, 2006 8:05 pm, Jonny Bergström wrote: > It's me again. I might have solved it... in a way. Still quite puzzled > about > why IE don't give a dime about the meta encoding line in the html head > tag. > > Here's what I did. The aforementioned header file now adds a header() > statement sending a content-type that also tells the charset, utf-8. : > > ---snip--- > header('Content-Type: text/html; charset=utf-8'); > echo '';?> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> > > > /> > > ---snip--- > > > I don't know if it's the best way to solve it but IE seems happy with > it, > and I haven't seen any sideeffects in FF so far. > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Internet Explorer doesn't display UTF-8 page using UTF-8 encoding
tedd wrote: At 6:48 PM -0700 8/12/06, Rasmus Lerdorf wrote: By the way, everyone should be setting a charset. If you don't set it, IE will look at the first 4k of the body of the page and take a wild guess. -Rasmus -Rasmus: Ok, but why doesn't w3c use it? http://validator.w3.org (check source) I'm not sure what to do re charset. I've been told by credible sources to "always use it" and "never use it" -- which is correct? Or, is this one of those "it depends" things? W3C is all about standards. IE is all about not following standards. If you want your site to work in the real world you should always set a charset. If you set it in your response header there is no need to set it in each page, and if you look closely, you will see that this is what w3.org is doing: 9:55am shiny:~> telnet validator.w3.org 80 Trying 133.27.228.132... Connected to validator.w3.org. Escape character is '^]'. HEAD / HTTP/1.0 HTTP/1.1 200 OK Date: Sun, 13 Aug 2006 18:42:15 GMT Server: Apache/2.0.54 (Debian GNU/Linux) mod_perl/1.999.21 Perl/v5.8.4 Accept-Ranges: bytes Connection: close Content-Type: text/html; charset=utf-8 -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Internet Explorer doesn't display UTF-8 page using UTF-8 encoding
At 6:48 PM -0700 8/12/06, Rasmus Lerdorf wrote: By the way, everyone should be setting a charset. If you don't set it, IE will look at the first 4k of the body of the page and take a wild guess. -Rasmus -Rasmus: Ok, but why doesn't w3c use it? http://validator.w3.org/ (check source) I'm not sure what to do re charset. I've been told by credible sources to "always use it" and "never use it" -- which is correct? Or, is this one of those "it depends" things? tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Internet Explorer doesn't display UTF-8 page using UTF-8 encoding
IE doesn't actually support XHTML, so if your primary target for something is IE, you really shouldn't be using XHTML. Even IE7 doesn't fully support it. Setting the charset in the response header like you did is the best approach. You can do it for all your pages in your php.ini file with: default_charset = "UTF-8" If you want to do it in your page contents, it needs to look like this: Your attempt with the xml header would have worked if IE knew what the heck XHTML was. By the way, everyone should be setting a charset. If you don't set it, IE will look at the first 4k of the body of the page and take a wild guess. If it guesses wrong, typically because someone injected UTF-7 into your page, then you have an XSS on your hands. -Rasmus Jonny Bergström wrote: It's me again. I might have solved it... in a way. Still quite puzzled about why IE don't give a dime about the meta encoding line in the html head tag. Here's what I did. The aforementioned header file now adds a header() statement sending a content-type that also tells the charset, utf-8. : ---snip--- ';?> http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> ---snip--- I don't know if it's the best way to solve it but IE seems happy with it, and I haven't seen any sideeffects in FF so far. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Internet Explorer doesn't display UTF-8 page using UTF-8 encoding
It's me again. I might have solved it... in a way. Still quite puzzled about why IE don't give a dime about the meta encoding line in the html head tag. Here's what I did. The aforementioned header file now adds a header() statement sending a content-type that also tells the charset, utf-8. : ---snip--- ';?> http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> ---snip--- I don't know if it's the best way to solve it but IE seems happy with it, and I haven't seen any sideeffects in FF so far.
[PHP] Re: Internet Explorer doesn't display UTF-8 page using UTF-8 encoding
...btw, I have been thinking, does IE only display UTF8 pages if the source file is saved using UTF8 *including* the BOM? I save all pages without the BOM because using BOM is impossible when you need to set cookies on client.