Super-fast DummyPants Addressbarlet for del.icio.us
Okay, so lately I've switched to using "addressbarlets" for my del.icio.us posting needs. In particular, I've been using the Super-Fast variety. I cannot stress how much better these are than clicking links in the bookmark toolbar. My del.icio.us posting has converged that much closer to command-line / QuickSilver perfection.
But, I just noticed that in my del.icio.us RSS feed, the title "del.icio.us warning: non-utf8 string! (sorry)" has been popping up--especially on Hot Links, which includes my links on a regular basis.
Well, although I'm not really all that hip to unicode and non-ASCII characters, it appears that things like SmartyPants and the use of chevrons in page titles are throwing the monkey wrench for me when the addressbarlet picks up the document.title
. So, I decided to do a little sloppy butchery in my bookmarklet code to wrestle these titles into something acceptable.
After you've had a chance to try out / comprehend the original versions, take a look at this revised addressbarlet:
In case, for some reason, that doesn't come through in this entry, here's the code which should appear in the HREF:
javascript:u=%22CHANGEME%22;us=[['\u201C','%22'],['\u201D','%22'],['\u2019',%22'%22],['\u2018',%22'%22],['\u2026',%22...%22],['\u00BB','-']];function es(p){for(var i=0;i<us .length;i++){p=p.replace(us[i][0],us[i][1])};p=p.replace(/[\u0080-\uFFFF]/g,'');return encodeURIComponent(p);};q=location.href;e=%22%22+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);p=document.title;window.location.href=%22http://del.icio.us/%22+u+%22?jump=doclose&tags=%22+es(%22%s%22)+%22&url=%22+es(q)+%22&description=%22+es(p)+%22&extended=%22+es('%22'+e+'%22').replace(/ /g,%22+%22);</textarea>
I'm sure I have a few nasty bugs lurking in there, but basically I'm trying to reverse SmartyPants--DummyPants, if you will--and crudely hack out everything that's not the usual ASCII.
If you happen to be having this problem, let me know if this code works for you.
shortname=dummypants
Archived Comments