May 19, 2003

Entity encoder bookmarklet

Steve Minutillo has created a bookmarklet that converts non-ASCII characters to HTML entities. A very sweet bookmarklet. If you're running IE 5.5+, Mac or PC, Mozilla 1.2 (Mac and PC). I haven't gotten it to work on Safari. But it is slick. ( via Antipixel )
Post Info

Tagged As Coding

Comments are Open (2)

Posted at 11:28 AM

Comments

steve

Let's see if it works in Safari:

你好嗎

Hmm... it works for me. I just typed those characters directly and then used the bookmarklet to convert them to entities. Remember, it only encodes characters in textareas and text input fields.

Tony

I can't make it work for the life of me in Safari. I get nothing. Tried in textareas and input.

But I figured it out. When I added the link as a bookmarklet in Safari, it converted things for me.

javascript:(function()%7Bfunction%20entities(e)%7Bf=e.value;t='';for(i=0;i%3Cf.length;i++)%7Bif(f.charCodeAt(i)%3E127)%7Bt+='&%23'+f.charCodeAt(i)+';';%7Delse%7Bt%20+=%20f.charAt(i);%7D%7De.value=t;%7Dl=document.getElementsByTagName('textarea');for(j=0;j%3Cl.length;j++)%7Bentities(l%5Bj%5D)%7Dl=document.getElementsByTagName('input');for(j=0;j%3Cl.length;j++)%7Bif(l%5Bj%5D.type=='text')entities(l%5Bj%5D)%7D%7D)()

is the code I got in Safari.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Search
Comments on this post
Categories
Info
Tony Stephens
Copyright © 1995-2005
Site Version:
10
Licensed:
Creative Commons
Validate:
XHTML, CSS, 508, RSS
Subscribe
Blog-Fu, Link-Fu