- my $entity_body = getmailbody($entity);
- @bodylines = $entity_body ? $entity_body->as_lines() : ();
+ my $entity_body = getmailbody($entity);
+ my $entity_body_handle;
+ my $charset;
+ if (defined $entity_body) {
+ $entity_body_handle = $entity_body->bodyhandle();
+ $charset = $entity_body->head()->mime_attr('content-type.charset');
+ }
+ @bodylines = $entity_body_handle ? $entity_body_handle->as_lines() : ();
+ @bodylines = map {convert_to_utf8($_,$charset)} @bodylines;