Sending Arabic Text by Email
I have a problem sending arabic text by email using java language.
this is my post in properties file:
mail.send = تجربة
I am using this syntax in jave:
ResourceBundle dq_resource = ResourceBundle.getBundle("nls.myfile_ar");
String text= dq_resource.getString("mail.send")
but when i received the email i have this text: ا ??????????? ¹
I am trying also in java with this code:
String text= new String(dq_resource.getString("mail.send").getBytes(),Charset.forName("UTF-8"));
but I have this text in the mail:
ا ??? ض? ع
You need to set a header for the mail, something like
message.setHeader("Content-Type", "text/plain; charset=UTF-8");
setHeader
is a class method Message
that allows you to set the title.
The simplest solution might be to use strings usually (without the getBytes method) changing the default encoding in your workspace, like eclipse.
Windows -> Preferences -> General -> Workspace -> Text Encoding
Also you can try converting UTF-8 to UTF-16 .