Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sending strange characters in JavaMail

 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20768
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic