Email::Store::Attachment - my losing battle
Jacqui Caren
jacqui.caren at ntlworld.com
Thu Nov 30 08:03:37 GMT 2006
Richard Clamp wrote:
> 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
and for bytea you have the double encoding issue which is covered by the
bind param Pg::BYTEA - see the DBD::Pg docs.
if you do not use this then you could end up with very odd results.
I found that data was truncated @~4KB for one 8.0 release.
Jacqui
More information about the london.pm
mailing list