Microsoft HTML help gotcha

I stumbled upon a “gotcha” today that could really perplex the average PC user.

 

I was putting some documents into folders based on the development language that they applied to. Naturally I put the C++ documents into the C++ folder, the Python documents into the Python folder etc.

documents/C++/
documents/python/
etc

These documents were in various formats – .pdf, .doc, .rtf, .txt, .chm.

After neatly filing all these documents I was surprised when I opened one of the .chm files to be greeted with this:

weird HTML help file error

weird HTML help file error

chm files are Microsoft’s compiled HTML help files that are the successor to the old windows help files, and are basically just compressed collections of html pages in a single file with indexing and contents built in.

The thing is, I knew that there was nothing wrong with the document I’d opened, because I had opened it just before I moved it into the new folder. I moved the file back into the folder it had originally been located in and opened it from there and it was fine (no errors – the title page displayed as I would expect).

This was mildly perplexing. I could open the file fine when it was in various folders on my machine, but when it was stored in my newly created folder, I was getting this internet connection error (on a local document that shouldn’t have been trying to access the internet at all).

The problem was, without thinking, I had placed it into the subfolder:

documents/languages/C#/

The compiled help file, being based on HTML uses Microsoft’s internet layout engine to render its pages, and its relative pathing was seeing the folder C#/ as a url bookmark instead of a valid part of a relative path.

Try it on your own machine – storing a chm document in a folder with a “#” in it effectively “breaks” the document.

Now I concede that using non alphanumeric folder names is poor practice, but to me this is more than just a weird quirk — it could absolutely baffle an ordinary user.

Should it be possible to “break” a help file and present a completely unhelpful error message just by putting it into a folder with a certain characteristic to its name?

Personally I don’t think so.