+ Start a Discussion
neuronneuron 

'String Too Long Error' on Rich Text Area field

I am trying to populate a rich text area field with an incoming email body(Using Email Services - Apex Email Handler).

The incoming email body can be of any size, but as the field can hold only 32768 characters, i am performing a truncation of the email body to lesser than 32768 chars and then populating it onto the field.

In this process i came across a few scenarios wherein in for one case the email body was around 56000 chars, it got truncated fine and the field update was successful. In another case the email body was 36000 chars, it got truncated fine but at the time of field update i am getting the String Too Long error.

Its quiet annoying as i am getting the error in some cases.

Background : The email body contains tables,special characters etc.

Can it be an encoding issue?