MovableBlog: Selecting Text Problems in IE 6?

Nuance 2.0

November 7, 2002

This is off-topic as far as Movable Type is concerned, but if you're having problems selecting text from your site in Internet Explorer 6, add this code to the first line of your code:

<?xml version="1.0" encoding="iso-8859-1"?>

If it gives you a PHP error, add this line instead:

<?php print "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>"; ?>

I found this here after searching Google Groups forever, giving up, and trying websites instead.

It works for me (over at China Weblog). Added bonus: it still validates XHTML Transitional 1.0.

Posted by Richard at 1:11


You can drag it slightly back on topic by noting that it's also one way to get rid of the IE6 scrolling bug that the MT templates have: it was working fine for me for that until I finally gave up on IE and switched to Phoenix.

That also throws IE6 out of standards mode and back into 'quirk' mode if I recall correctly. This could have issues if your blog uses a bunch of margin & padding CSS.

Make sure people test in IE6 after they add that line.

Is Phil's post above in regard to when IE only shows half the page and you have to force-reload to get it to show correctly?
If so, I will be adding that to my template tonight and dealing with any positioning problems later. :-D

One unfortunate side effect of doing this is that IE 6 then starts having the box model problems that IE 5.5 has. It interprets borders and padding as being inside the specified width instead of outside of it.

For DOCTYPE 'switches' check here and here (the last one is IE 6 specific). China Weblog looks right with the XML tag, but yes, heed Erik's advice and test in IE 6 before proceeding.

The proper way to prevent the php parsing error when adding the xml prolog is to turn off the php short_open_tag in httpd.conf or in your .htaccess file. Just add the following line:

php_value short_open_tag off

This will of course break any php script that utilize the short_open_tag ("<?" instead of "<?php").
IMHO the short_open_tag should not be used in the first place and should have been turned off by default (maybe in PHP 6).
Also, I think that a xml-prolog should always be used as it is a W3C recommendation and as it declares the encoding. It is true that it will put ie6pc into quirks mode, which means it will apply ie5pc's broken box-model (margins are not an issue as Erik suggested, just padding and border). Those who use boxes have to consider ie5pc anyway and code around it, since a lot of people still use that browser.

ie 5 (mac) can't select text properly either; both solutions parses badly.


Thank you so very much! I was ripping my hair out. I knew it was a bug, but my searches were coming up null.