Custom field min_length and max_length checks and multibyte strings
|Resolution:||Wont fix||Affected version:|
If custom field contains multibyte string as a value, CustomValue.validate method will fail if byte length of string is out of range [min_length, max_length].
I've tried to use
ActiveSupport::Multibyte::Chars and it fixed my case, but i don't know whether it is a right solution.
#2 Updated by Vitaliy Ischenko about 11 years ago
I've created ProjectCustomFieldFor example:
- Name: Test
- Format: text
- Min length: 5
- Max length: 7
no default value, no regex
checkboxes left untouched
Then i've navigated to project settings and entered value 'АБВГДЕЖ'
After submitting - validation error appears: "Test is too long (maximum is 7 characters)"
#3 Updated by Vitaliy Ischenko about 11 years ago
I've forgotten to mention a link http://stackoverflow.com/questions/1989154/does-ruby-share-phps-multibyte-string-problem
#4 Updated by Felix Schäfer about 11 years ago
I can confirm this problem, but I think as rails3/ruby1.9 is "around the corner", there's no big motivation for the core redmine to get adapted, though what you propose seems to be the preferred way to solve that. If you want to contribute those fixes back, make sure the existing tests pass and create some new to test the multibyte characters.