vaibhav
vaibhav

Reputation: 4103

UTF-8 characters not getting displayed

When i run my JUnit test case to invoke the standalone application which sends mail the characters are getting displayed properly in mail but when this application runs on a different machine through a thread it displayed ? instead of the real characters. This program of mine sends uses sendMail of unix and the remote machine uses POSTFIX. can someone think of possible reasons of problem?

Upvotes: 2

Views: 781

Answers (2)

tchrist
tchrist

Reputation: 80415

You probably forgot to explicitly set the encoding of your output stream to UTF‐8. Java’s normal default encoding is some platform‐local 8‐bit thing that naughtily replaces misfits with ? characters.

You should probably do this in your program itself. However, you might get away with passing ‑Dfile.encoding=UTF‑8 on the javac command line. Just depends.

Upvotes: 1

dty
dty

Reputation: 18998

Show some code. But most likely, you aren't explicitly specifying the character encoding you want to use, and the default on one platform works as you expect, and the default on another doesn't.

Upvotes: 1

Related Questions