UTF-8 characters not getting displayed
When i run my JUnit test case to invoke the standalone application which sends mail th开发者_JS百科e 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?
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.
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.
精彩评论