Commit 7db4f03ac2679d1be0c9a09ff176391bc87a68d2

use charset=UTF-8 instead of encoding=utf-8 in download links

Reported by Lachy:
http://krijnhoetmer.nl/irc-logs/whatwg/20100202#l-531
live/live.js
(12 / 12)
  
1111 return $('<pre>'+text.replace(/&/g, '&amp;').replace(/</g, '&lt;')+'</pre>');
1212}
1313
14function downloadIt($appendee, mime, data) {
15 $appendee.append($('<a class="download" href="data:'+mime+','+encodeURI(data)+'">Download it!</a>'));
14function downloadIt(mime, data) {
15 return $('<a class="download" href="data:'+mime+';charset=UTF-8,'+encodeURI(data)+'">Download it!</a>');
1616}
1717
18function noItems($appendee, name, itemtype, spec) {
19 $appendee.append($('<i>No <a href="'+spec+'">'+name+'</a> items (items with <code>itemtype="'+itemtype+'"</code>)</i>'));
18function noItems(name, itemtype, spec) {
19 return $('<i>No <a href="'+spec+'">'+name+'</a> items (items with <code>itemtype="'+itemtype+'"</code>)</i>');
2020}
2121
2222function updateTab(index) {
2525 var $json = $('#json').empty();
2626 var jsonText = $.microdata.json();
2727 $json.append(pre(jsonText));
28 downloadIt($json, 'application/json;encoding=utf-8', jsonText);
28 $json.append(downloadIt('application/json', jsonText));
2929 break;
3030 case 2:
3131 var $turtle = $('#turtle').empty();
3232 var turtleText = $.microdata.turtle();
3333 $turtle.append(pre(turtleText));
34 downloadIt($turtle, 'text/turtle;encoding=utf-8', turtleText);
34 $turtle.append(downloadIt('text/turtle', turtleText));
3535 break;
3636 case 3:
3737 var $vcard = $('#vcard').empty();
4242 if (i > 0)
4343 $vcard.append(document.createElement('hr'));
4444 $vcard.append(pre(vcardText));
45 downloadIt($vcard, 'text/directory;profile=vCard;encoding=utf-8', vcardText);
45 $vcard.append(downloadIt('text/directory;profile=vCard', vcardText));
4646 });
4747 } else {
48 noItems($vcard, 'vCard', 'http://microformats.org/profile/hcard',
49 'http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#vcard');
48 $vcard.append(noItems('vCard', 'http://microformats.org/profile/hcard',
49 'http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#vcard'));
5050 }
5151 break;
5252 case 4: // iCal
5454 var icalText = $.microdata.ical();
5555 if (icalText) {
5656 $ical.append(pre(icalText));
57 downloadIt($ical, 'text/calendar;componenet=vevent;encoding=utf-8', icalText);
57 $ical.append(downloadIt('text/calendar;componenet=vevent', icalText));
5858 } else {
59 noItems($ical, 'vEvent', 'http://microformats.org/profile/hcalendar#vevent',
60 'http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#vevent');
59 $ical.append(noItems('vEvent', 'http://microformats.org/profile/hcalendar#vevent',
60 'http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#vevent'));
6161 }
6262 break;
6363 }