Fix issue with IE8 and single quotes

IE8 doesn't support `&apos;`, so don't use it when building encoded forms - use `&#39;` instead, which all browsers support.