Email::Store::Attachment - my losing battle

Richard Clamp richardc at unixbeard.net
Wed Nov 29 14:15:51 GMT 2006


Chisel Wright wrote:
> $ cat test_email_attached_jpg.eml |./email_store_2 
> Entity: evil_chisel.jpg at
> /usr/local/share/perl/5.8.8/Email/Store/Attachment.pm line 28.
> Can't insert new Email::Store::Attachment: DBD::Pg::st execute failed:
> ERROR:  invalid byte sequence for encoding "UTF8": 0xff
>  [for Statement "INSERT INTO attachment (content_type, filename,
> payload, id, mail)
> VALUES (?, ?, ?, ?, ?)
> " with ParamValues: 4='10', 1='image/jpeg', 3='.�.�',
> 2='evil_chisel.jpg', 5='20061129125014.GD7541 at herlpacker.co.uk'] at
> /usr/share/perl5/DBIx/ContextualFetch.pm line 52.
>  at /usr/local/share/perl/5.8.8/Module/Pluggable/Ordered.pm line 51
> ---- cut here ----
> 
> I can make the email available message if required.


Here's your problem:

 From 
http://search.cpan.org/src/RJBS/Email-Store-0.254/lib/Email/Store/Attachment.pm

CREATE TABLE IF NOT EXISTS attachment (
     id           integer NOT NULL PRIMARY KEY AUTO_INCREMENT,
     mail         varchar(255),
     payload      text,
                  ^^^^^
     filename     varchar(255),
     content_type varchar(255)
);

Postgres is trying to be clever because it knows it's interacting with a 
text column.  That should probably be bytea for pg. 
http://www.postgresql.org/docs/8.1/interactive/datatype.html

-- 
Richard Clamp <richardc at unixbeard.net>


More information about the london.pm mailing list