CodeIgniter Forums
UTF-8 and wrong input cleaning - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: UTF-8 and wrong input cleaning (/showthread.php?tid=48363)



UTF-8 and wrong input cleaning - El Forum - 01-13-2012

[eluser]Unknown[/eluser]
Hello there,

after building a website i found following issue while handling with UTF-8 characters like german umlauts, etc.

My config files are all proper set and the headers of my documents are correctly set so UTF-8.

The problem I had, was, while submitting a form, the CI-Form-validator showed a Required-message, as if there was no input. This was because the input class uses the function "clean_string()" of the UTF-8 class for security reasons, but which returns an empty string, if there are chars like € or ä.

e.g.
Code:
echo $this->utf8->clean_string('abcdefg');         // prints correctly 'abcdefg'
echo $this->utf8->clean_string('äbcd€fg');         // prints nothing

Why is this so? Why does CI remove all UTF-8 related characters in his UTF-8 class?
Any ideas to fix this?

Thanks!
bubinsk

PS: I'm running PHP 5.3.5 with MAMP on a mac machine with the latest CI build.