Welcome Guest, Not a member yet? Register   Sign In
international chars in form
#1

[eluser]toltmanns[/eluser]
Hey all,

I've been using CI for about two weeks and I'm loving it. That said, I am running into an issue where I am trying to input foreign characters and they are not making it to the $_POST variable. I suspect that it has something to do with system/core/input.php because it seems to be loaded/fired each time. I tested my problem with a bare bones form posting to itself - copied some arabic characters and $_POST spits it out - in my test case.

I've set the charset meta tag - and confirmed through firefox View Page Info. I've also set accept-charset="UTF-8" attribute in the form.

Am I missing something, or is there any workaround for this? I'd hate to have to scrap my beautiful codeigniter solution to allow this functionality.

Thanks,
Troy
#2

[eluser]toltmanns[/eluser]
AHA!

I just did a var_dump( $_POST ) at the top of input.php and I see that my foreign chars (español) are there where they should be. But when they are dumped from the controller, they are gone.

I'll keep crawling through the input.php, but I would really appreciate any input here.
#3

[eluser]toltmanns[/eluser]
I've dug a little deeper and have found the function clean_string in the system/core/Utf8.php is causing the issue.

$str = @iconv('UTF-8', 'UTF-8//IGNORE', $str);


http://www.utf8-chartable.de/ shows that the enyay (below) is in the charset
U+00F1 ñ c3 b1 LATIN SMALL LETTER N WITH TILDE

So I am wondering what if the function clean_string is working right, php.net says that the first two arguments are in and out strings, so why does the system assume that I am inputting UTF-8? Why, if the character is included in UTF-8, is the function failing?
#4

[eluser]toltmanns[/eluser]
I've just went ahead and commented out $str = @iconv(‘UTF-8’, ‘UTF-8//IGNORE’, $str); and it seems to be functioning like I would expect, after I tweaked my db settings.

Now I just wonder what else commenting that method will effect, seems to me that the only place it's used is in the input cleaning - so what are the impacts of doing this? will there be any security issues or db issues that will arise from this change?

Thanks
#5

[eluser]CodeIgniteMe[/eluser]
Maybe it's because of the XSS_filter option in your config file.




Theme © iAndrew 2016 - Forum software by © MyBB