- 论坛徽章:
- 0
|
- if (subject != null) {
- try {
- subject = new String(subject.getBytes("iso-8859-1"));
- System.out.println("subject:" + subject);
- }
- catch (Exception e) {
- System.out.print(e.toString());
- }
- }
- if (body != null) {
- try {
- body = new String(body.getBytes("iso-8859-1"),"gb2312");
- System.out.println("body:" + body);
- }
- catch (Exception e) {
- System.out.print(e.toString());
- }
- }
- sun.misc.BASE64Encoder enc = new sun.misc.BASE64Encoder();
- newmsg.setSubject("=?GB2312?B?" + enc.encode(subject.getBytes()) + "?=");
- msg.setContent(body, "text/plain;charset=gb2312");
复制代码 |
|