Maxlength of TDBEdit wrong when string fields in dataset are UTF8
Original Reporter info from Mantis: evdb
-
Reporter name: Erwin van den Bosch
Original Reporter info from Mantis: evdb
- Reporter name: Erwin van den Bosch
Description:
I'm using IBX components for connecting FirebirdSQL. My database is UTF8. When I add string fields to the TIBQuery component the field size is 4 times bigger then what the user could input in that field. This is because of the buffer size needed to store UTF8 characters.
Now the problem: The maxlength of TDBEdit is depending on the fieldsize (which is 4 times bigger). So the user can type more characters in the field then he should be able to. For example: Database string field size is 10. TStringField.size is 40. Maxlength of TDBEdit is 40 and not 10. If you type more then 10 charaters in the field you get nasty errors.
Additional information:
If I patch dbedit.inc and do:
MaxLength := DatalinkField.Size div 4;
Then my problem is solved. But this is not a good solution. The TDBEdit control should be aware of the number of bytes a character takes. (but i don't know how)
Mantis conversion info:
- Mantis ID: 25698
- Version: 1.0.14