0

decodeURIComponent throwing an error while decoding the encoded data in php.

data is encoded in PHP using rawurlencode function and while decoding in js we are using decodeURIComponent.

For few data I am getting an error for other values it is working fine.

Question: I want to know is there any alternate to rawurlencode or decodeURIComponent

ρяσѕρєя K
  • 132,198
  • 53
  • 198
  • 213
Sunil
  • 19
  • 1
  • 8
  • welcome to stackoverflow sunil :). it will be easy for the ppl who can give your answer if you provide your code or anything which you tried so far & if any error or something you got than please provide error log ,exception etc. so user can easily go to that direction and provide you help – user1140237 Jan 07 '16 at 05:37
  • Thanks user1140237 :) Sorry user1140237 as I cant provide any logs as I work for a company but my question is similar to http://stackoverflow.com/questions/28063750/decodeuricomponent-throwing-an-error-uri-malformed but it is not helping me in any way – Sunil Jan 07 '16 at 05:51
  • I found the reason why it was happening **Process:** Fetch the data from db ----> encode the data in php using rawurlencode() ----> Send the data to frontend ----> Decode the data using decodeURIComponent(),process it and display it. **Problem:** Db has special character �(http://www.cogsci.ed.ac.uk/~richard/utf-8.cgi?input=%F6&mode=char) which was not encoded properly so decodeURIComponent function was throwing error. – Sunil Jan 07 '16 at 13:09

0 Answers0