Miguel, > I'm having some trouble reading the fields "subject" and "from_addr" from > msgs table, they are in latin1 encoding, I need them in UTF8. > > The only way I'm able to do this is to issue an update to the msgs table > preceded by a "set names utf8": > > <code> > $conn_h->execute("set names utf8"); > $conn_h->execute($upd_msg2, $from, $subj, $mail_id); > $conn_h->execute("set names latin1"); > </code> > I've tested this code, and works fine with my web gui. > > $upd_msg2 only updates the 2 fields i want. > > Is there another way to do this?
Perhaps declaring a character set on these two columns would achieve what you need: from_addr varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT '', subject varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT '', Amavisd does a MIME charset conversion to UTF-8 when storing From and Subject header fields to table msgs, so it should be safe to declare them as utf8 in SQL, i.e. the result should be a valid UTF-8 string, as guaranteed by Perl. > $upd_msg2 only updates the 2 fields i want. > Will this break amavis ? No, amavisd only writes these two fields, and never reads them back. > Should I create 2 new fields to store the utf8 version of these two fields? There is probably no need for this. Mark ------------------------------------------------------------------------------ _______________________________________________ AMaViS-user mailing list AMaViS-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amavis-user Please visit http://www.ijs.si/software/amavisd/ regularly For administrativa requests please send email to rainer at openantivirus dot org