thisObject
06-03-2006, 11:49 PM
Hello,
I have a program that gets user's input (String s = reguest.getParameter(“Title”))
Than this string is sent to a method that sends email containing this string (s).
When I pass this string to sendSSLMessage it gets corrupted (instead of Russian letters I get question marks or some garbage).
I was able to set subject in Russian by using unicode letter such as \u0430 etc. But if the input comes from html page it gets messed up.
Encoding that is used on html page is Windows-1251.
Here is the code:
request.setCharacterEncoding(“”Cp1251);
String titleDb = reguest.getParameter(“Title”);
sendEmail.sendSSLMessage(“asdf@asdf.com”, titleDb, “someEmail@someDomain.com”);
sendSSLMessage(String recipient, String body, String from)
{
...
MimeMessage msg = new MimeMessage(session);
try
{
msg.setSubject(“some russian chars”, “UTF-8”);
msg.setText(body, ”UTF-8”);
msg.Content()body, “text/html; charset=UTF-8”);
}
Transport.send(msg);
...
}
What can be done to have Russian letters display normally?
Thank you
I have a program that gets user's input (String s = reguest.getParameter(“Title”))
Than this string is sent to a method that sends email containing this string (s).
When I pass this string to sendSSLMessage it gets corrupted (instead of Russian letters I get question marks or some garbage).
I was able to set subject in Russian by using unicode letter such as \u0430 etc. But if the input comes from html page it gets messed up.
Encoding that is used on html page is Windows-1251.
Here is the code:
request.setCharacterEncoding(“”Cp1251);
String titleDb = reguest.getParameter(“Title”);
sendEmail.sendSSLMessage(“asdf@asdf.com”, titleDb, “someEmail@someDomain.com”);
sendSSLMessage(String recipient, String body, String from)
{
...
MimeMessage msg = new MimeMessage(session);
try
{
msg.setSubject(“some russian chars”, “UTF-8”);
msg.setText(body, ”UTF-8”);
msg.Content()body, “text/html; charset=UTF-8”);
}
Transport.send(msg);
...
}
What can be done to have Russian letters display normally?
Thank you