- # Turn *off* the SvUTF8 bits here so decode_utf8 and from_to below can work.
- local $@;
- Encode::_utf8_off($content);
+ my $entity = MIME::Entity->new();
+ $entity->head->add("Content-Type", $self->GetHeader("Content-Type"));
+ $entity->bodyhandle( MIME::Body::Scalar->new( $content ) );
+ my $from = RT::I18N::_FindOrGuessCharset($entity);
+ $from = 'utf-8' if not $from or not Encode::find_encoding($from);