When introducing some special characters that are larger when they are html encoded, the maximum length of the database field can be bypassed. Probably there should be an aditional check to see if the data will fit in the database field.