Internationalization issue with count(STRING) 

Relying on substr($buffer,0,count($buffer)-3) in some systems leads to broken insert statements because of multibyte chars issues (http://www.php.net/manual/en/intro.mbstring.php). Moving to mb_substr and mb_strlen is not a solution, so I've completely rewrote this to be done without any string operators.
Also I've removed is_integer check, cause it will always return false here (http://www.php.net/manual/en/function.is-int.php). To test if a variable is a number or a numeric string, we must use is_numeric(). Anyway, there is no need of this, cause MySQL is doing automatic conversion on insert. 
Merge pull request #6 from Ritsuka/master

Internationalization issue with count(STRING)