File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes Sending strange characters in JavaMail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Sending strange characters in JavaMail" Watch "Sending strange characters in JavaMail" New topic
Author

Sending strange characters in JavaMail

Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 732
I written a program by using javaMail API but when am sending mail in English language I receive in readable shape but when am sending mail in Arabic then am receiving strange characters. What should I do?

Thanks & best regards
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19682
    
  19

Change the charset you are using. I believe the charset is part of the content type in emails. For instance, from one of my own emails:

Just use the same for your emails but then of course with a charset that supports Arabic characters.

SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4650
    
    5

Is it really as simple as setting the charset?

Do the RFC's allow non-ASCII in the headers?

I assume that non-ASCII bodies are simply converted as MIME-parts during transport.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Pat Farrell wrote:Do the RFC's allow non-ASCII in the headers?


Yes, they do. And JavaMail takes care of implementing the complicated escaping that the RFCs require.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4650
    
    5

Paul Clapham wrote: JavaMail takes care of implementing the complicated escaping that the RFCs require.

I bet is quite complicated.

In the olden days, when I spoke RFC, the headers had to be 8-bit clean. And they really wanted 7 bit US ASCII.

Guess the Internet really is international.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sending strange characters in JavaMail