CodeIgniter Forums
Special character insert into mssql - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Special character insert into mssql (/thread-55916.html)

Pages: 1 2


Special character insert into mssql - El Forum - 11-19-2012

[eluser]Narf[/eluser]
I assume those values come from user input (e.g. POST data) and as a security measure CodeIgniter translates a few special characters that are found in GET, POST and COOKIE data. This isn't related to character sets.


Special character insert into mssql - El Forum - 11-19-2012

[eluser]Juzt1s[/eluser]
How do I remove that kind of security?

And yes, it comes from user input. I've change a line in config.php to allow specialcharacters.


Special character insert into mssql - El Forum - 11-19-2012

[eluser]Narf[/eluser]
This is hard-coded, you can't affect it by changing a configuration setting. Just decode those characters before inserting them into the database.


Special character insert into mssql - El Forum - 11-19-2012

[eluser]Juzt1s[/eluser]
I've tired using : http://www.php.net/manual/en/function.iconv.php

did not help :/


Special character insert into mssql - El Forum - 11-19-2012

[eluser]Narf[/eluser]
Again, these are HTML entities, nothing to do with character sets. You need htmlspecialchars_decode().


Special character insert into mssql - El Forum - 11-19-2012

[eluser]Juzt1s[/eluser]
Got it working. Thnx.


Used:
Code:
$newname = htmlentities($oldname);



Special character insert into mssql - El Forum - 11-19-2012

[eluser]Narf[/eluser]
Sorry, I gave you the wrong function. Although you should've done at least some research on your own.

Code:
php > echo html_entity_decode('()');
()



Special character insert into mssql - El Forum - 11-19-2012

[eluser]Juzt1s[/eluser]
I did. Thank you. Now it works great Smile