pop3.au3如何显示中文文件标题?
用pop3.au3来获取中文文件标题时总是显示乱码!如标题为“二次函数”,显示的却是“=?UTF-8?B?5LqM5qyh5Ye95pWw?=”!这个好像是UTF-8编码的。如何显示为中文呢?望高手解决!官方pop3.au3:
http://www.autoitx.com/forum.php?mod=viewthread&tid=5923&highlight=pop3
邮件的解码算法
以下好像是vc++6.o的邮件的解码算法,如何将它转换为Au3呢?#include "stdio.h"
void main(int argc, char * argv[])
{
FILE * fp; char ch, ch1, ch2;
unsigned char hz;
fp = fopen("d:\\a", "rt");
for (;;)
{
ch = getc(fp);
if (ch == EOF)
break;
if (ch == '=')
{
ch1 = getc(fp);
if (ch1 == '\n' || ch1 == '=')
{
fseek(fp , -1, SEEK_CUR);
continue;
}
ch2 = getc(fp);
hz = (ch1>'9'?ch1-'A'+10:ch1-'0')*16+(ch2>'9'?ch2-'A'+10:ch2-'0');
putchar(hz);
}
else
putchar(ch);
}
fclose(fp);
getchar();
} 帮忙顶,我也想知道这个问题如何解决。 我这里碰到的是gb2312,base64编码的邮件标题解码问题。
演示如何解码,字符串应该是诸如Subject: =?gb2312?B?xOO6w6Oh?=的B?后的字符串
$Decrypt = _Base64Decode("ZXIiIENFTExQQURESU5HPTAgQ0VMTFNQQUNJTkc9MD48VFI+PFREIGhlaWdodD0iMzAiPiA8dGFibGUgd2lkdGg9IjEwMCUiIGJvcmRlcj0iMCIgYWxpZ249ImNlbnRlciIgY2VsbHBhZGRpbmc9Ijgi")MsgBox(0, '', $Decrypt)
MsgBox(0, '', BinaryToString($Decrypt))
base64的udf
Func _Base64Decode($Data)
Local $Opcode = "0xC81000005356578365F800E8500000003EFFFFFF3F3435363738393A3B3C3DFFFFFF00FFFFFF000102030405060708090A0B0C0D0E0F10111213141516171819FFFFFFFFFFFF1A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132338F45F08B7D0C8B5D0831D2E9910000008365FC00837DFC047D548A034384C0750383EA033C3D75094A803B3D75014AB00084C0751A837DFC047D0D8B75FCC64435F400FF45FCEBED6A018F45F8EB1F3C2B72193C7A77150FB6F083EE2B0375F08A068B75FC884435F4FF45FCEBA68D75F4668B06C0E002C0EC0408E08807668B4601C0E004C0EC0208E08847018A4602C0E00624C00A46038847028D7F038D5203837DF8000F8465FFFFFF89D05F5E5BC9C21000"
Local $CodeBuffer = DllStructCreate("byte[" & BinaryLen($Opcode) & "]")
DllStructSetData($CodeBuffer, 1, $Opcode)
Local $Ouput = DllStructCreate("byte[" & BinaryLen($Data) & "]")
Local $Ret = DllCall("user32.dll", "int", "CallWindowProc", "ptr", DllStructGetPtr($CodeBuffer), _
"str", $Data, _
"ptr", DllStructGetPtr($Ouput), _
"int", 0, _
"int", 0)
Return BinaryMid(DllStructGetData($Ouput, 1), 1, $Ret)
EndFunc
来自官方论坛的BASE64 UDF
页:
[1]