Problem when inserting special characters into input-fields, resulting in blank $this->input->get_post("title") #30

bitbucket-import opened this Issue Aug 19, 2011 · 7 comments


None yet

6 participants


Hi there,

I have a problem with special characters. I want to input text like "Ich wünschte es wäre Samstag", but the validation class won't validate it and returns an error. If I comment out the validation rules, it runs trough the script but inserts "" (blank) into the database. This only happens, when I try to input special characters (ä, ö, ü, etc.), non-special characters work fine.

The weird thing is, that this bug only happens with PHP 5.3.5. When I switch to PHP 5.2.17 everything works fine.

Here's some of my code:



$this->form_validation->set_rules("title", "Title", "trim|required|xss-clean|max_length[1000]");

if ($this->form_validation->run()) == FALSE) {
// Load 'fail-form'
} else {
// Escape data and insert into db
// Display 'success-page'


Here's my test-input:
title = "I wish today would be Saturday"
result = validates fine, database data correct
title = "Ich wünschte heute wäre Samstag"
result = doesn't validate (error: title field is required, or results in blank field on db if validation is commented out)

In addition, my database is set to "utf8_general_ci" and I'm using utf-8 as my content type.

Kind regards and thanks in advance,


I can confirm this issue. MAMP 1.9.5 and PHP 5.3.5.

The problem is that iconv doesn't work right in PHP in this version of MAMP. So, not really a CI bug as much as a problem with the environment. Took me lots of hours to track this down yesterday and today.


Yeah, MAMP did a number with iconv. Its quirks compared to a realistic production environment is one of the reasons I do not use it.


iconv is buggy, isn't it? How about using mbstring first?


Multibyte string functions aren't enabled in many PHP environments, and the iconv solution to provide clean utf-8 has been in use for many years by many applications and frameworks.


Is this issue still present in MAMP 2.0.1? I kind of get the same error, will try it out on my server now.


I can confirm this issue in MAMP 2.0.1. It works fine on PHP Version 5.2.4-2 ubuntu linux 2.6.18-028stab092


This is fixed in MAMP 2.0.2 and later.

@bhj bhj closed this Nov 14, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment