CodeIgniter Forums
decoding encodeURIComponent() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: decoding encodeURIComponent() (/showthread.php?tid=71902)



decoding encodeURIComponent() - richb201 - 10-06-2018

I am using encodeURIComponent() in my javascript program before I send over an email address to the server.

the email is arriving at the CI program as this and I tried using entity_decode 
$email_key = entity_decode($json2->email,"@");

When the email arrives at the CI controller it is now "bandfrombossanova%40gmail.com.
But my attempt to decode it in CI is causing an issue. Is entity_decode the proper way to get back the email ([email protected])?  


RE: decoding encodeURIComponent() - jreklund - 10-07-2018

http://php.net/manual/en/function.urldecode.php
http://www.php.net/manual/en/function.rawurldecode.php


RE: decoding encodeURIComponent() - php_rocs - 10-08-2018

@richb201,

You could also decode in the Javascript too (https://www.w3schools.com/jsref/jsref_decodeuricomponent.asp ).