Day 29 – URL Encode Strings

For those late evenings when you just need a good cold URL encoded string….

ruleset a60x525 {
  meta {
    name "uri-escape"
    description <<
      uri-escape
    >>
    author "Mike Grace"
    logging on
  }

  rule ehskahpeh {
    select when pageview ".*"
    pre {
      restfulYql = "http://query.yahooapis.com/v1/public/yql?q=";
      queryStatement = "select * from html where url='www.kynetx.com'";
      finalThingy = restfulYql + uri:escape(queryStatement);
      appender =<<
        <h1>#{finalThingy}</h1>
      >>;
    }
    {
      append("body", appender);
    }
  }
}
  • 11 movie reference

App run on example.com with bookmarklet

Get the bookmarklet to try it out yourself!

Gratuitous day 29 Grace face

About these ads
This entry was posted in Kynetx. Bookmark the permalink.

One Response to Day 29 – URL Encode Strings

  1. SS says:

    Is there an equivalent uri:unescape function ? (doesn’t seem to work – but hoping there is one by another name).
    PS: Thanks for a wonderful series btw. Given the somewhat patchy official documentation – your blog is a lifeline of KRL syntax and options (more like an (un)official cookbook :) )

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s