Curious if anyone knows if codeigniter’s form validation built in max_length[n] and min_length[n] functions count unicode characters as 1 character or the sum of all the characters used symbolize the unicode character?
I noticed when I var_dump the string it counts all the characters, just wondering if code igniter or php has a built in function to count unicode characters?
Thanks.
Codeigniter uses php’s mb_strlen if it’s available on your php installation which allows for an encoding parameter to be passed along, otherwise it defaults to php’s basic strlength which doesn’t allow you to pass the string encoding along. The trouble is that CI doesn’t give you the ability to pass along the possible encoding for max_length[n]…
If you need it to compensate for the encoding, you might be better served rolling your own validation with just raw php.