Dedicated to my late brave, beautiful and silly mummy, Debra Ross. I love you mumster.

Skip navigation

Conflicting xml:lang attribute woes

Singapore photo by Majush
Singapore photo by User:Majush on Wikipedia

This is yet another example of why growing up in multiple countries and cities stuffs you up as an adult. Don’t get me wrong, I wouldn’t have traded living in different places for anything in the world because it really opened my eyes and allowed me to expand my views of the world outside Australia, but it wasn’t all a free lunch. Like having prata and teh tarik at 3am. Where was I going with this?

Today’s example is the XML language attribute which the relative XHTML standards demand. I could just define the xml:lang and lang tags in the html element as "en" for English. The problem is English is so generic these days as to be next to useless. I use the original English spelling instead of American spelling for most words given I’m an Aussie, but I also use more than a few Singaporean colloquialisms. Aiyo. For this reason using "en-au" probably wouldn’t be completely accurate, but "en-sg" would be even less accurate. "en-gb" would reflect the spelling, but then there’s the problem that Google might index my page as one originating from the UK.

Do Austrians who have since moved to Switzerland or Germany have this problem? Or Germans who have since moved to Austria or Switzerland have this problem? Or do Schweizerdeutsch speakers who have since moved to Germany or Austria have this problem?

Perhaps I should just set my language to Klingon and be done with it.

Specify image dimensions and save the world!

Jo Anne Hook painting: Australian Wildflowers

One of the more pleasurable things in life is when you can get on your high horse and let the rest of the world know why they’re wrong, and you’re right. Or maybe that only applies to conversations about music. Sorry Elke, comparing Akon to The Rat Pack is like comparing Barry Manilow to Jo Anne Hook. Wait, Jo Anne Hook is a painter. Never mind.

My gripe today is with people who use images in HTML on websites without defining their dimensions! You’ve probably seen pages at one point that seem to rearrange themselves as material moves around to make way for images that are loading. By defining the sizes of images in advance, browsers know how much visual space to allocate them as it draws the page.

Without declared dimensions
<img src="image.jpg" alt="description" />
Using HTML dimensions
<img src="image.jpg" alt="description"
width="320" height="240" />
Using inline CSS
<img src="image.jpg" alt="desccription"
style="width:320px; height:240px;" />
Using an external style sheet
Same as latter, but using an external style sheet linked with an id statement for individual images, or more pratically using class for many images on a page with the same dimensions.

Autumn anime art using... defined image dimensions!

Without this information, the browser is forced to render the page as it would look without the image until it has reached it; this is especially noticeable on slower internet connections and on mobile phones. It also does nothing to help the sanity of people who are halfway through reading a paragraph and suddenly have the text disappear as it’s pushed away by an image that has started loading!

As far as I know from my own experience, Typo, WordPress and MediaWiki conveniently specify image sizes automagically on images you upload and insert, and I assume most other content management systems do too… save for Blosxom of course! Wow Blosxom, the first weblog publishing system I ever used, that brings back memories!

Save the world: specify image dimensions!

The Internet Explorer Q Continuum

As you may have gathered from reading previous posts, I’m a Mac OS X user on laptops and a hopeless FreeBSD fanboy on desktops. Therefore it probably wouldn’t surprise you to find out I’m not a fan of Internet Explorer, or Windows Internet Explorer, or Chuck Norris Explorer or whatever they’re calling it at the moment.

Why though? Is it the fact that it successfully and demonstrably held back innovation on the intertubes for so many years? Is it the silly user interface in version 7 which I get calls from people constantly asking me how they get to the menu bar? Is it the fact their CSS support is so patchy and inconsistent it makes a part of my work even more difficult than it has to be? Is it because it was bundled with a monopolistic operating system? Is it because the e logo just looks plain silly?

No. It’s for one simple fact: Internet Explorer doesn’t support the <q> tag!

Look at that browser Jean Luc, it doesn't support my existence!
Look at that browser Jean Luc, it doesn’t support my existence!

You could be forgiven for not knowing about this tiny little tag; it was included by the W3C back in the HTML 4.0 specification in 1997 to delimitate small inline quotations which are not large enough to justify the use of a block level element, but current versions of IE are the only browsers even in 2008 not to support it, despite every other game in town having no trouble with them.

For example, one of the sentences below is enclosed in <q> tags. If you’re using Internet Explorer they will look exactly the same:

Ruben Schade is an incredibly smart, devilishly attractive and very self deluded person.

Ruben Schade is an incredibly smart, devilishly attractive and very self deluded person.

But why is the lack of support for a seemingly insignificant and easily replaceable tag my number one gripe with Internet Explorer? Because of its stupefying simplicity! How difficult would it have been for Microsoft to have added full support for such a simple tag? It’s mind blowing!

<q>This is an inline quote, complete with CSS support!</q>

<span class="quote">Here's another inline quote, but with support for IE </span>

I guess until Internet Explorer 12 comes out some time after 2095, I’ll have to stick with using the latter example above. What a mess!

FOOTNOTE: For what it’s worth, Opera, Mozilla Firefox, Netscape Navigator (rest in peace), Apple’s Safari, KDE’s Konqueror and even zippy little dillo, links and lynx support the <q> tag. Obviously it’s not hard!

Further Reading

Using HTML, XHTML for word processing

EDIT: I just realised that the draft version (without any links) of this post was the one that was published, not the final one. It’s been all fixed up.

With all the talk these days about online word processors such as Google Documents and gOffice replacing traditional client installed office suites such as OpenOffice.org, it got me thinking: do more technically inclined computers users actually need word processors at all anymore?

Think about it: if you’re a web programmer or have any experience in HTML (preferably one of the XHTML varieties) and CSS you have everything you need to create a professional looking document, and as I discovered, it takes a lot less effort.

With any word processor I’ve ever used I’ve always found it to be a struggle to use the inbuilt templates and formats for headings, lists and so forth. With HTML I have complete control over what everything looks like and where everything goes, I can change the entire formatting of a document on the fly, and the resulting document (if done correctly) is a standards based file which can be read on virtually any computer with a simple web browser, and it’s in a format which I know many years from now I will still be able to open and access, I can embed microformats such as hCards into my documents (very useful for letters), I can create different stylesheets for screen and print views, I can use easily edited meta tags to denote the copyright, language, date, author, keywords, owner and description of a document… the list goes on.

Now granted there could be some downsides depending on who you are. Some people might find the use of <tags /> to be cumbersome and annoying, and I certainly don’t expect everyone to pick it up, but if you have the experience it can work out to be a very efficient and quick way to type something up.

And the best part of it all? You don’t need a fancy word processing programme with bucket loads of features you’ll never use: all you need is a lightweight text editor, and maybe a PDF exporting programme to help with creating separate, printable pages if you run a flavour of Windows.

So how do I use HTML to create documents? Argh, two rhetorical questions in the one post. This is no good. I now have a file called master.html sitting in my home directory that I use as a template for new documents; I simply copy the file, change the meta data and write up the document.

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN”
“http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>

<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en-AU”>
<head profile=”http://www.w3.org/2006/03/hcard”>
<title>DOCUMENT NAME By Ruben Schade</title>

<meta http-equiv=”Content-Language” content=”en-AU” />
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />
<meta name=”author” content =”Ruben Schade” />
<meta name=”copyright” content=”http://creativecommons.org/licenses/by/3.0/” />
<meta name=”description” content=”DOCUMENT DESCRIPTION” />
<meta name=”owner” content=”Ruben Schade” />

<style type=”text/css” media=”all”>
body {
  font-family: Georgia, Antiqua, “Times New Roman”, Times, sans-serif;
  line-height : 1.6em;
  padding: 2em;
  text-align:justify;
}
</style>
</head>

<body>
<!– DOCUMENT GOES HERE –>
</body>

</html>

How does the McDonald’s theme song go? “I’m loving it!”