Friday, June 5, 2009

Client Aid: Microsoft Outlook displays PDF as garbled text

Well, this little not-so-reproducable pickle was tricky to figure out! One of our Web Design clients, for whom we had created a newsletter broadcast application, reported that when they send themselves a preview, clicking on the http links to PDF files were replacing the entire email message with "garbled text".

During the brief conference call, our team were noting things such as:
  • "corrupt pdf" (could be)
  • "problems with the way the PDF was being uploaded" (possibly)
  • that "somehow the header was being stripped during upload
    (far fetched).
  • "gzip compression" (nope, couldn't be it)
  • caching? (nope, not that either)
After the meeting was over, first thing we did was try it for ourselves.

First up was to send ourselves a preview email and retrieve the email using the Mozilla Thunderbird E-Mail Client.

It worked for us! Clicking on the PDF link in Thunderbird showed no problems. We called the client and asked them to do the same - the behaviour was confirmed. It was working on the Mozilla Thunderbird E-Mail Client, but not the client's primary e-mail client which was Microsoft Outlook 2003.

We did some further analysis and concluded that MS Outlook 2003 was actually trying to load the pdf http link sent in a HTML e-mail as a regular HTML page. This explains why clicking on the http links to PDF files displays "garbled text".

Although not so W3C compliant, the only solution to this was to add a "target" attribute to the pdf link to force it to open in a new window.

At the end, our client was happily chuckling "why didn't we think of that" when we told them what the problem actually was and how to fix it. A simple solution to a very strange problem, but most of the work we had done was to actually pin-point where and how this behaviour was occuring.

This solution of course came free of charge - we know how to look after our clients and will do favours such as these, whenever possible, as required.

0 comments: