Thursday, October 13, 2011

Escape or Encode the character using javascript or ruby

Guys,
          When we are storing the data in the database using any encoding method like UTF-8 and retrieve data in javascript it gives us in output in decode and unescape format.

To solve above issue using javascript or ruby
Javascript functions:
escape(String) - unescape(String)
encodeURI(String) - decodeURI(String)
encodeURIComponent(String) - decodeURIComponent(String)

Ruby methods:
CGI.escape(String) - CGI.unescape(String) or CGI.unescapeHTML(String)
URI.escape(String) - URI.unescape(String)

Online tool for escape/unescape, encode/decode the character.
http://www.the-art-of-web.com/javascript/escape/

No comments:

Post a Comment