線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1798
推到 Plurk!
推到 Facebook!

IdMessage主旨長度超過46會出現異常狀況

尚未結案
peterpcc
一般會員


發表:6
回覆:37
積分:13
註冊:2004-09-27

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-12-08 22:57:57 IP:221.239.xxx.xxx 未訂閱
sorry! 在這麼多的歷史資料查詢後,總是試不出來. IdMessage主旨長度超過46個字,就亂碼了. 請問我該怎麼處理這問題呢? Base64Decode的函式我倒是有取得,不過就是不清楚該怎麼去運用?
allenchan
資深會員


發表:10
回覆:306
積分:283
註冊:2004-01-06

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-12-08 23:53:45 IP:61.62.xxx.xxx 未訂閱
參考這篇看看: http://delphi.ktop.com.tw/topic.php?TOPIC_ID=58424
peterpcc
一般會員


發表:6
回覆:37
積分:13
註冊:2004-09-27

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-12-09 08:30:55 IP:221.239.xxx.xxx 未訂閱
with IdMessage1 do
    begin
      From.Address:=DRLabel13.Caption;     
      From.Name:=tToken(DRLabel13.Caption,'@',1);
      Recipients.EMailAddresses := v_recipients;    
      CCList.EMailAddresses := ''; {CC}
      BccList.EMailAddresses := ''; {BBC}
      Subject := v_Subject; { Subject: header }
      Subject :=Base64Decode(v_Subject);           // 1
      IdMessage1.MessageParts.Clear;
      Tidtext.Create(IdMessage1.MessageParts);
      with Tidtext.Create(IdMessage1.MessageParts,v_Strings) do
        ContentType:='text/plain';
      for i:=0 to listbox1.Count-1 do
        TIdAttachment.Create(IdMessage1.MessageParts, Listbox1.Items[i])
    end;
//我想可能是我判斷處錯了,因為我追蹤時,發現Base64Decode函數並未執行到. while pos('=?big5?b?',lowercase(strInput)) > 0 do // 這段沒執行到 begin try posStart := pos('=?big5?b?',lowercase(strInput)); posEnd := pos('?=',lowercase(strInput)); strDecode := strDecode copy(strInput,1,posStart-1) IdDecoderMIME1.DecodeString(copy(strInput,posStart 9,posEnd-posStart-9)); strInput := copy(strInput,posEnd 2,length(strInput)-posEnd-1); finally Application.ProcessMessages; end; end; strDecode := strDecode strInput; result := strDecode;
allenchan
資深會員


發表:10
回覆:306
積分:283
註冊:2004-01-06

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-12-09 13:32:51 IP:203.70.xxx.xxx 未訂閱
其實不太懂您的描述,Base64Decode 是一個您自己撰寫的 Function? 內容為:
while pos('=?big5?b?',lowercase(strInput)) > 0 do // 這段沒執行到
begin
  try
    posStart := pos('=?big5?b?',lowercase(strInput));
    posEnd := pos('?=',lowercase(strInput));
    strDecode := strDecode   copy(strInput,1,posStart-1)   IdDecoderMIME1.DecodeString(copy(strInput,posStart 9,posEnd-posStart-9));
      strInput := copy(strInput,posEnd 2,length(strInput)-posEnd-1);
    finally
      Application.ProcessMessages;
    end;
  end;
  strDecode := strDecode   strInput;
  result := strDecode;
end;
當你呼叫 Base64Decode 時,他執行到 while pos('=?big5?b?',lowercase(strInput)) > 0 do 結果條件不成立嗎?還是有啥狀況?所謂的沒執行到是?
peterpcc
一般會員


發表:6
回覆:37
積分:13
註冊:2004-09-27

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-12-09 14:14:58 IP:221.239.xxx.xxx 未訂閱
function TForm1.Base64Decode(strInput : string) : string;
var
  strDecode : string;
  posStart: Integer;
  posEnd : Integer;
while pos('=?big5?b?',lowercase(strInput)) > 0 do // 這段沒執行到
begin
  try
    posStart := pos('=?big5?b?',lowercase(strInput));
    posEnd := pos('?=',lowercase(strInput));
    strDecode := strDecode   copy(strInput,1,posStart-1)   IdDecoderMIME1.DecodeString(copy(strInput,posStart 9,posEnd-posStart-9));
      strInput := copy(strInput,posEnd 2,length(strInput)-posEnd-1);
    finally
      Application.ProcessMessages;
    end;
  end;
  strDecode := strDecode   strInput;
  result := strDecode;
end;
這是取自這兒高手的內容,我的意思是while那段的條件沒成立過,追蹤時看到代入的都是文字串,並沒有=?big5?b?'這些字在. 所以我就弄不清楚,到底應該在哪時候去做這Base64Decode的動作?
allenchan
資深會員


發表:10
回覆:306
積分:283
註冊:2004-01-06

發送簡訊給我
#6 引用回覆 回覆 發表時間:2004-12-09 14:24:27 IP:203.70.xxx.xxx 未訂閱
請問您傳入 Base64Decode 前的 v_Subject 內容為何?
peterpcc
一般會員


發表:6
回覆:37
積分:13
註冊:2004-09-27

發送簡訊給我
#7 引用回覆 回覆 發表時間:2004-12-09 14:32:44 IP:221.239.xxx.xxx 未訂閱
'[查詢編號:][SEK][CUST]測試資料長度超過46字時問題' 內容就是這樣的文字.
allenchan
資深會員


發表:10
回覆:306
積分:283
註冊:2004-01-06

發送簡訊給我
#8 引用回覆 回覆 發表時間:2004-12-09 15:27:06 IP:203.70.xxx.xxx 未訂閱
所以我想這段文字應該是沒有 Encode 過的吧?那你為啥要去 Decode 呢?
peterpcc
一般會員


發表:6
回覆:37
積分:13
註冊:2004-09-27

發送簡訊給我
#9 引用回覆 回覆 發表時間:2004-12-09 15:46:04 IP:221.239.xxx.xxx 未訂閱
主要因素就是因為主旨碼長度超過46字時,內容就變亂碼了 我將主旨先 Encode 再Decode ,結果內容有了,主旨卻亂了 不好意思,這兒初學,所以讓您見笑了,希望能幫我解決這主旨亂碼問題.
peterpcc
一般會員


發表:6
回覆:37
積分:13
註冊:2004-09-27

發送簡訊給我
#10 引用回覆 回覆 發表時間:2004-12-09 21:16:49 IP:221.239.xxx.xxx 未訂閱
剛剛更新到indy 10後,發現問題已解決了. 謝謝allenchan的熱心解答.
Blueberrug
一般會員


發表:14
回覆:50
積分:17
註冊:2005-05-22

發送簡訊給我
#11 引用回覆 回覆 發表時間:2005-06-10 18:22:51 IP:220.130.xxx.xxx 未訂閱
你好: 不知道為啥我目前的主旨只要key中文字, 也都是亂碼,不過我沒有超過24個中文字, 也還是亂碼,請問是否要升級到indy 10.0版的呢? 才不會出現亂碼。
Ktop_Robot
站務副站長


發表:0
回覆:3511
積分:0
註冊:2007-04-17

發送簡訊給我
#12 引用回覆 回覆 發表時間:2007-04-26 13:50:46 IP:000.000.xxx.xxx 未訂閱
提問者您好:


以上回應是否已得到滿意的答覆?


若已得到滿意的答覆,請在一週內結案,否則請在一週內回覆還有什麼未盡事宜,不然,
將由版主(尚無版主之區域將由副站長或站長)自由心證,選擇較合適之解答予以結案處理,
被選上之答題者同樣會有加分獎勵同時發問者將受到扣 1 分的處分。不便之處,請見諒。


有問有答有結案,才能有良性的互動,良好的討論環境需要大家共同維護,感謝您的配合。

------
我是機器人,我不接受簡訊.
系統時間:2024-05-17 12:51:10
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!