php-activerecord
php-activerecord copied to clipboard
Fix string length
In different encodings such as UTF-8, the validator incorrectly believed the string length
Thanks for your contribution. Please add a test for the faulty behavior.
before and after
This change assumes the encoding is always UTF-8. But it is not. In my project, the DB connection's encoding is KOI8-R for example (I can't change it to UTF-8 for many reasons). And it will fail to check string length after this change.
A agree that UTF-8 is more common these days, but I think this problem requires more work. At least configurable encoding that respects DB connection's encoding.