Home > PHP Solutions > How to Decode Javascript Escaped Text with PHP

How to Decode Javascript Escaped Text with PHP

Recently I had to decode a string that was encoded with javascript, using ascii codes of symbols. In JavaScript everything looks simple – unescape() allows to get a readable string. But I had to do it with PHP and the first thought was to use chr and ord functions. But there was a simple solution as usual.

I had to use urldecode to obtain readable text from JavaScript escaped string. Though my string was not an URL, everything went well. So this function might be useful not only for URL decoding, but also helps to deal with Javascript encoding.

  1. No comments yet.
  1. No trackbacks yet.