public static String decodeWord(String s)
{
if(!s.startsWith("=?"))
return s;
int i = 2;
int j;
if((j = s.indexOf(63, i)) == -1)
return s;
String s1 = (s.substring(i, j));
i = j + 1;
if((j = s.indexOf(63, i)) == -1)
return s;
String s2 = s.substring(i, j);
i = j + 1;
if((j = s.indexOf("?=", i)) == -1)
return s;
String s3 = s.substring(i, j);
try
{
ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(s3.getBytes());
Object obj;
if(s2.equalsIgnoreCase("B"))
obj = new com.sun.mail.util.BASE64DecoderStream(bytearrayinputstream);
else
if(s2.equalsIgnoreCase("Q"))
obj = new com.sun.mail.util.QDecoderStream(bytearrayinputstream);
else
return s;
int k = bytearrayinputstream.available();
byte abyte0[] = new byte[k];
k = ((InputStream) (obj)).read(abyte0, 0, k);
return new String(abyte0, 0, k );
}
catch(Exception ex)
{
return s;
}
}
{
if(!s.startsWith("=?"))
return s;
int i = 2;
int j;
if((j = s.indexOf(63, i)) == -1)
return s;
String s1 = (s.substring(i, j));
i = j + 1;
if((j = s.indexOf(63, i)) == -1)
return s;
String s2 = s.substring(i, j);
i = j + 1;
if((j = s.indexOf("?=", i)) == -1)
return s;
String s3 = s.substring(i, j);
try
{
ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(s3.getBytes());
Object obj;
if(s2.equalsIgnoreCase("B"))
obj = new com.sun.mail.util.BASE64DecoderStream(bytearrayinputstream);
else
if(s2.equalsIgnoreCase("Q"))
obj = new com.sun.mail.util.QDecoderStream(bytearrayinputstream);
else
return s;
int k = bytearrayinputstream.available();
byte abyte0[] = new byte[k];
k = ((InputStream) (obj)).read(abyte0, 0, k);
return new String(abyte0, 0, k );
}
catch(Exception ex)
{
return s;
}
}
上面的方法我试了,可以对“=?ISO-8859-1?Q?=A1=B6C++ Programming Language =CC=D8=B1=F0=B0=E6=A1=B7=D2=D1=B5=BD=A3=A1”进行处理,但是对其他的行还是不行,
???PHP/MYSQL???
??????
ssreader???
问题依旧。