. .

st4u

ST 4U 195: URL encode/decode in VA Smalltalk

February 17, 2012 9:28:48.902

Today's Smalltalk 4 You looks at url encoding and decoding in VA Smalltalk. If you have trouble viewing it here in the browser, you can also navigate directly to YouTube. To watch now, click on the image below:

url encoding.

If you have trouble viewing that directly, you can click here to download the video directly. If you need the video in a Windows Media format, then download that here.

You can also watch it on YouTube:


Today we'll take a look at url encoding and decoding in VA Smalltalk. When making HTTP requests and posts, it's quite common to have to deal with encoded content. Fortunately, it's easy to do in VA. To Encode, we'll use an url:


"encode an url"
url := 'http://www.jarober.com/blog/blogView?entry=3506669370'.
encoded := url sstUrlEncode.
^encoded. 

'http://www.jarober.com/blog/blogView?entry=3506669370'


You can see the encoded text right there. Now the reverse - decoding an encoded string:


"decode"
decoded := encoded sstUrlDecodeQueryComponent.
^decoded

 'http://www.jarober.com/blog/blogView?entry=3506669370'



And there's the result, back in its original form. That's all there is to it.

Need more help? There's a screencast for other topics like this which you may want to watch. Questions? Try the "Chat with James" Google gadget over in the sidebar.

Technorati Tags: , ,

Enclosures:
[st4u195-iPhone.m4v ( Size: 2646996 )]

posted by James Robertson

 Share Tweet This