| URLencode Widget Information
Introduction
This widget will take any text on your clipboard and URLencode
or URLdecode it.
Warning!
The MacOSX clipboard is capable of copying rtf formatted text.
(Notice when you copy from a webpage and then paste it into TextEdit,
it usually still has the fonts, formatting, and colors). The URLencode
widget attempts to translate that text to plain text before encoding it!
Usage
To use the URLencode, simply copy some text onto your clipboard
(Command - c), then open your Dashboard (F12 is the default button), and
then click either the ENCODE or DECODE buttons on the URLencode Widget.
The resulting text will be on your clipboard, ready to be pasted (Command
- v) into a different place.
Why would you want to do this, you ask? Well, many people who work as
programmers, database admins, XML users, and the like, tend to need to
have text encoded by hand on occasion. Encoding the text changes all special
characters including spaces into a 3 character string starting with %
and ending with the two digit ASCII code for the character.
This is important when placing text into a URL string (can't have spaces
in a website address, for instance), or when placing text inside of the
attribute of an XML tag (where a " character would result in illegal
XML). I needed this functionality for myself, and chose to make a Dashboard
Widget to do the work for me.
An example of encoding text would be as follows:
Hey! Would you like some Ice Cream???
Would be encoded to:
Hey%21%20Would%20you%20like%20some%20Ice%20Cream%3F%3F%3F%00
How it works
For you geeks who want to know how it works, this is simply using
Applescript's ability to change the class of the text to "ktxt".
Then it runs the javascript encode() or decode() functions on the resulting
text and places the result onto the clipboard again.
Known issues and bugs
- some rtf (rich text) formatting seems to break in the Applescript
conversion to plain text, leaving you with incomplete results. If possible,
it is best to have plain text on your clipboard before encoding or decoding.
Disclaimer
Use this software at your own risk. I am not responsible for anything
that might go wrong when using the URLencode Widget.
Contact
I wrote this simply for my own use, and don't plan on actively supporting
it. But if you have questions or comments, feel free to contact me via
email
Enjoy!
|