Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Strange caracters appears in subject with tSendMail in JAVA on linux

Hello,
I'm French, and I want to send an email with caracters ISO-8859-15 for example. How can I do it ?
Actually, I wrote in my Job : "Tickets à fermer"
And I receive : "=?ANSI_X3.4-1968?Q?Tickets_=3F_fermer?="
My Job is make on Windows with Java code (everythings work) but when I export the job in POJO for a linux computer, those caracters appears.
I tried to set ENV with LANG, LC_ALL but no change.
Labels (3)
3 Replies
Anonymous
Not applicable

hi gr_nomad,
did you test with encoding iso-8859-1 (latin) (iso-8859-15 add some 'very' special caracter like euro symbol ?)
You tell that you have coded in java.
I'd made a routine to send some file by mail and i had to specify the content type for the body part :
File f = new File(file);
DataSource source = new FileDataSource(f);

BodyPart bodypart = new MimeBodyPart();
bodypart.setDataHandler(new DataHandler(source));
bodypart.setFileName(name);
bodypart.addHeader("Content-type", "text/plain; charset=us-ascii");
bodypart.addHeader("Content-Transfert-Encoding","base64");

for my goal us-ascii was enought 0683p000009MACn.png
i've to specify (force) the encoding base64 (the way data are send via mail attachment) with a little more code
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(bodypart);
message.setContent(multipart);
message.saveChanges();
// forcer l'encodage
bodypart.setHeader("Content-Transfer-Encoding", "base64");

Transport transport = session.getTransport("smtp");
transport.connect(smtpHost,"flux@landes-mutualite.fr","********");
transport.sendMessage(message, message.getAllRecipients());
transport.close();

hope it could solve your problems
ps : working on linux
laurent
_AnonymousUser
Specialist III
Specialist III
Author

ok, thks.
So, just for information, I can't use the tSendMail component, and I will use your code in a tJava ?
It's good for me, but it is very strange TOS doesn't make this parameters on its component.
Can't we make an overload of this component in order to add somes parameters like encoding, and else ?
--
gr
Anonymous
Not applicable

you can do a lot with Talend Component tSendMail, but for my special case ,it was easier to use a routine.
(and re-write code adding some "specification" like force encoding base64).
I was thinking about your problem of charaters and some difference between encoding OS.
Perhaps try first to convert file with tools "dos2unix" (command line : $ dos2unix )
If your job work on Window , it must 0683p000009MACn.png work on *nux !!!
make some test with another tools : iconv !
I think it's better to manage your encoding .
but never mind , i can give you my "routines code of send mail" if you want !
laurent
ps : find in the java sun mail FAQ
You have to specify the right character set. By default, Mail:0683p000009M9p6.pngendmail puts the following header in the mail
Content-type: text/plain; charset="iso-8859-1"

so the send of the mail seems to be not guilty !
try to convert your file
Did you try with utf-8 encoding !?