Tuesday, May 15, 2007

Bad bad (en)coding

Microsoft home page has two different encodings (charset) in the META tag - UTF-8 and UTF-16. If you take the page byte array and convert to string using these encodings, the string with UTF-16 gives you junk characters. Now, browsers generally ignore the advisory encodings given by the html and figure out using their own method. Apparently, IE has better encoding detection that Mozilla family. But, then if I am building a simple application, which will not have such sophisticated pieces in place, then it is source enormous grief. While working with some non-English sites, we came across bunch of sites which think "utf-8" is some innocent directive you can put in the html page. This is the bad thing about standards. There are just too many of them.

ms-home-page-src


ms-encoding-utf8


ms-encoding-utf16

Labels: ,


Friday, April 27, 2007

Standards

"We don't read standards. We define them." - M

"OK, then. We'll embarrass you. " - G



The file format of the home page of MSN Spaces is unrecognized, according to Google. So, they provide a link to HTML version, which is generally reserved for doc, pdf, ppt and other browser un-friendly formats. The reason for unrecognized format is due to the Content-Type header sent by the web server. In this case it is

Content-Type: application/xhtml+xml; charset=utf-8


which, generally, is

Content-Type: text/html; charset=[encoding]


This is getting interesting. People wrote all kind of broken HTML code as IE used to handle that gracefully. IE also handled the ugly code generated by Front Page. The vicious circle just produced huge amount of junk. But, with Google search result page becoming gateway to the world, some care needs to be taken not to upset the Big Brother. Tomorrow if they incorporate conformance to W3C standards in ranking of pages (who know, they might already have,) all the broken html pages will, effectively, be inaccessible from the in web.

Labels: ,


This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]