CodeIgniter Forums
Wrong result of length validation when using russian and utf-8 - 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: Wrong result of length validation when using russian and utf-8 (/showthread.php?tid=3090)



Wrong result of length validation when using russian and utf-8 - El Forum - 09-09-2007

[eluser]Unknown[/eluser]
The case is simple:

When I input 10-letters word in the field and set max_length[20] for it, it validates. And when there's 11-letters word, validator raises an error "The title field can not exceed 20 characters in length.", that is certainly wrong.

I suppose, the reason is that utf-8 is two-byte encoding.


Wrong result of length validation when using russian and utf-8 - El Forum - 09-10-2007

[eluser]alpar[/eluser]
your right, the problem is from utf-8 and PHP not supporting it. Try finding a single byte encoding for your language. Or you could try using mb_string extension for php, but is slower, and you will have to make changes is many places in the framework.