\ Index \

ActionScript 3 - unescape Method change

by Ben Rhodes - 2007

The unescape method in ActionScript 3 has been changed from ActionScript 1 & 2. It no longer converts the plus sign to a space. This was a surprise when I needed to convert an urlencoded string. To fix this, you have to use the replace String Method after the unescape method is called to replace all plus signs with a blank space.

The ActionScript 3.0 code:

var readableString:String = unescape(urlencodedString).replace(/\+/g, " ");

ActionScript 2.0 Example - unescape()

ActionScript 3.0 Example - unescape()

ActionScript 3.0 Example - unescape() and replace() : We now get the desired result.