0

So this application will just send out emails based on text present in files in a folder. So they have UTF-8 characters and when running the project on eclipse the emails go out with UTF-8 characters properly, but when I export it as runnable jar the characters are changed to question marks "???????" in the email Subject line.

Any idea as to how I can fix this? The existing questions were based on print writer or writing to txt file.

Shruti Saagar
  • 79
  • 1
  • 11
  • This is not a duplicate question as the previous ones have to do something with filewriting or output stream writing. If there is an existing question where Bill's answer is there then I will delete this question, but I couldn't find it. – Shruti Saagar May 05 '17 at 10:32

1 Answers1

1

When you set the content of the message, are you telling it to use the utf-8 charset? Or are you just defaulting to the system charset? If the latter, that's probably why you're getting different results in Eclipse. Try setting the charset explicitly in the setText method, or set the System property mail.mime.charset to "utf-8".

Bill Shannon
  • 29,579
  • 6
  • 38
  • 40