E-com DevBlog Spider-ball-vacuum

9Feb/120

Easiest URLEncoding Method Ever

Easy%20URLEncode

Why leave your browser?

I've been doing some ridiculously complicated parameter passing between a server script and a javascript plugin that ahs finally required me to encode the values into a URLEncoded fashion.  To do this I would normally crack open my Adobe Air app that I use for encoding and decoding form data, but I just realized that there was a little voice in my head telling that what I was doing it wasn't necessarily wrong, but just over-complicated.

Don't get me wrong, the Air App I have is great, and yes, I could build a utility in PHP-and-friends that would accomplish the same thing.  But stay with me, this is about the easiest, most readily available method ever, not the most involved.

Please note that the following instructions contain a bit of humor aimed at Internet Explorer users.  We are all aware of the limitations of the browser, and the fact that it is slowly getting better. So remember, it's all in good fun :) .  Here we go.

Chrome/Safari users:

  1. Open Web Inspector (ctrl-shift-i/option-command-i)
  2. Open the console
  3. Type: escape("The values you want escaped go here, seriously");
  4. Press Enter
  5. Copy your URLEncoded data out of the console

Firefox/Aurora users:

  1. Get Firebug
  2. Open Firebug (F12)
  3. Open the Console tab
  4. Type: escape("The values you want escaped go here, throw in some extra characters, like I'm awesome searching http://www.google.com/");
  5. Press Enter
  6. Copy your URLEncoded data out of the console

Internet Explorer Users:

  1. Download Chrome or Firefox
  2. Follow the steps above for the browser you downloaded.
  3. Remember that IT blocked you from using or downloading a modern browser, so give up and open IE anyway
  4. Press F12 and pray that you have the less-than-stellar-copy of Firebug/Web Inspector available
  5. Rejoice because it is installed, Click on the Console tab
  6. Type: escape("Wow, this totally works in IE, and I'm pleasantly surprised by that fact");
  7. Press Enter
  8. Copy the URLEncoded data out of the console

Unescaping or URLDecoding

Isn't that awesome?  Now that you can encode the data, you probably want to decode it right?  Follow the same method as above, only use the following function:

unescape("URLEncoded%20data%20goes%20here");

That's it, easy, built-in URLEncoding and URLDecoding from the browser that you are already working in and developing with.  Now go out there and save the world from too many slashes and quotes getting in the way!

Print This Post Print This Post
1Feb/122

LESS is more

LESS logo

LESS - The dynamic Stylesheet lanugage

I've seen it, I've ignored it, and now it's time to embrace and post about it.  If you haven't already given it the time of day, it's time to crawl out from under the rock and start learning LESS.

LESS bills itself as "The Dynamic Stylesheet language", and even for a self-billing, it is dead-on.  LESS allows the use of variables, mixins, a nested rule system, and the use of functions within your CSS.  All of this is processed through some black JavaScript magic, so you don't need to worry about possible performance kills in your vanilla stylesheet.

LESS isn't just for client-side operations either, it can be integrated with both Node.js and Rhino.

Who is using LESS? Fair enough question, many sites are using LESS right now but perhaps you should check out the Twitter Bootstrap that is built using LESS.

I could give you quite a few examples here to really get you salivating, but I find that when someone has already done the work, I may as well have you go there. So to get your hands dirty and start using LESS, just hit up the official site.

Print This Post Print This Post