2022年10月23日 星期日

MIME - content-type

網址:  https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types

目的:  取得正式的 MIME  文件的 content-type

Two primary MIME types are important for the role of default types:

  • text/plain is the default value for textual files. A textual file should be human-readable and must not contain binary data.
  • application/octet-stream is the default value for all other cases. An unknown file type should use this type. Browsers pay a particular care when manipulating these files, to protect users from software vulnerabilities and possible dangerous behavior.
ExtensionKind of documentMIME Type
.aacAAC audioaudio/aac
.abwAbiWord documentapplication/x-abiword
.arcArchive document (multiple files embedded)application/x-freearc
.avifAVIF imageimage/avif
.aviAVI: Audio Video Interleavevideo/x-msvideo
.azwAmazon Kindle eBook formatapplication/vnd.amazon.ebook
.binAny kind of binary dataapplication/octet-stream
.bmpWindows OS/2 Bitmap Graphicsimage/bmp
.bzBZip archiveapplication/x-bzip
.bz2BZip2 archiveapplication/x-bzip2
.cdaCD audioapplication/x-cdf
.cshC-Shell scriptapplication/x-csh
.cssCascading Style Sheets (CSS)text/css
.csvComma-separated values (CSV)text/csv
.docMicrosoft Wordapplication/msword
.docxMicrosoft Word (OpenXML)application/vnd.openxmlformats-officedocument.wordprocessingml.document
.eotMS Embedded OpenType fontsapplication/vnd.ms-fontobject
.epubElectronic publication (EPUB)application/epub+zip
.gzGZip Compressed Archiveapplication/gzip
.gifGraphics Interchange Format (GIF)image/gif
.htm .htmlHyperText Markup Language (HTML)text/html
.icoIcon formatimage/vnd.microsoft.icon
.icsiCalendar formattext/calendar
.jarJava Archive (JAR)application/java-archive
.jpeg .jpgJPEG imagesimage/jpeg
.jsJavaScripttext/javascript (Specifications: HTML and RFC 9239)
.jsonJSON formatapplication/json
.jsonldJSON-LD formatapplication/ld+json
.mid .midiMusical Instrument Digital Interface (MIDI)audio/midi audio/x-midi
.mjsJavaScript moduletext/javascript
.mp3MP3 audioaudio/mpeg
.mp4MP4 videovideo/mp4
.mpegMPEG Videovideo/mpeg
.mpkgApple Installer Packageapplication/vnd.apple.installer+xml
.odpOpenDocument presentation documentapplication/vnd.oasis.opendocument.presentation
.odsOpenDocument spreadsheet documentapplication/vnd.oasis.opendocument.spreadsheet
.odtOpenDocument text documentapplication/vnd.oasis.opendocument.text
.ogaOGG audioaudio/ogg
.ogvOGG videovideo/ogg
.ogxOGGapplication/ogg
.opusOpus audioaudio/opus
.otfOpenType fontfont/otf
.pngPortable Network Graphicsimage/png
.pdfAdobe Portable Document Format (PDF)application/pdf
.phpHypertext Preprocessor (Personal Home Page)application/x-httpd-php
.pptMicrosoft PowerPointapplication/vnd.ms-powerpoint
.pptxMicrosoft PowerPoint (OpenXML)application/vnd.openxmlformats-officedocument.presentationml.presentation
.rarRAR archiveapplication/vnd.rar
.rtfRich Text Format (RTF)application/rtf
.shBourne shell scriptapplication/x-sh
.svgScalable Vector Graphics (SVG)image/svg+xml
.tarTape Archive (TAR)application/x-tar
.tif .tiffTagged Image File Format (TIFF)image/tiff
.tsMPEG transport streamvideo/mp2t
.ttfTrueType Fontfont/ttf
.txtText, (generally ASCII or ISO 8859-n)text/plain
.vsdMicrosoft Visioapplication/vnd.visio
.wavWaveform Audio Formataudio/wav
.webaWEBM audioaudio/webm
.webmWEBM videovideo/webm
.webpWEBP imageimage/webp
.woffWeb Open Font Format (WOFF)font/woff
.woff2Web Open Font Format (WOFF)font/woff2
.xhtmlXHTMLapplication/xhtml+xml
.xlsMicrosoft Excelapplication/vnd.ms-excel
.xlsxMicrosoft Excel (OpenXML)application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xmlXMLapplication/xml is recommended as of RFC 7303 (section 4.1), but text/xml is still used sometimes. You can assign a specific MIME type to a file with .xml extension depending on how its contents are meant to be interpreted. For instance, an Atom feed is application/atom+xml, but application/xml serves as a valid default.
.xulXULapplication/vnd.mozilla.xul+xml
.zipZIP archiveapplication/zip
.3gp3GPP audio/video containervideo/3gppaudio/3gpp if it doesn't contain video
.3g23GPP2 audio/video containervideo/3gpp2audio/3gpp2 if it doesn't contain video
.7z7-zip archiveapplication/x-7z-compressed

V80C03 - 匯出目前畫面 store 的資料 - f_downloadFile -自己產生Form & submit,不會傳畫面欄位值

 目的: V80C03 - 匯出目前畫面  store 的資料

處理說明: 1>f_downloadFile 函式會自已產生 Form  & submit , 
                       並不會帶本子視窗畫面的 欄位值(Ex: chkboxgroup2)



1>*.js
 //匯出
    function xlsOutBtn_click() {
        var np = s_JSON('s_form'); //TMFunction.js, 組合form上的查詢條件為json參數傳遞
        np["FName"] = "V80C03_匯出.xlsx";

        console.log("np:", np);
        console.log("FName: ", np.FName);
        //EX_DFile : cookies, 傳回訊息  - 因傳回檔案不可用 HttpMessage , 所以用 Cookie 傳訊息
         //f_downloadFile 函式會自已產生 Form  & submit , 並不會帶本子視窗畫面的 欄位值(Ex: chkboxgroup2)
        f_downloadFile('EX_DFile', '../api/V80C03API/ExportdFile', np, 'POST', function () {
            var r = r_cookies('EX_DFile');
            if (!checkisnull(r)) 
                mysuccessalert(r);
        });
    };


2>*.cs
//V80C03  匯出 *.XLS 檔案  - 匯出

        [HttpPost]
        public void ExportdFile()
        {
            var c = HttpContext.Current;
            NameValueCollection nvc = c.Request.Form;

            //匯出時, 不分頁(par_paging=false), 資料全取 
            DataSet ds = getGridData_M(false);

            string Tmp_FName = nvc["FName"];   //含 *.xls
            //string fName = Tmp_FNAME + ".xlsx";
            string fName = Tmp_FName;
            Workbook wk = null;
            MemoryStream stream = new MemoryStream();
            string Tmp_Str = "";
            int Tmp_Cnt = 0;
            HttpCookie MyCookie;
            try
            {

                wk = new Workbook();
                Worksheet sheet1 = wk.Worksheets[0];//獲取第一個工作表
                //共 13 欄
                //項次  日期(DT) PLANDCARD 領班 領班姓名 小組長 小組長姓名 小組成員(EMPLYID) 成員姓名 人(STAFF) 天(DURAION) 工時(STDHRS) 已報工時

                string[] outFieldArray = { "項次", "日期(DT)", "PLANDCARD", "領班", "領班姓名", "小組長", 
                                                           "小組長姓名", "小組成員(EMPLYID)", "成員姓名", "人(STAFF)" , "天(DURAION)",
                                                           "工時(STDHRS)", "已報工時"};
                for (int i = 0; i < outFieldArray.Length; i++)
                {
                    sheet1.Range[myfunc.GetExcelPos(i, 0)].Text = outFieldArray[i];
                }

                DataTable dt = ds.Tables[1];
                Tmp_Cnt = dt.Rows.Count;
                //Tmp_Str = "已匯出完成!!  ("+Tmp_Cnt.ToString() +"筆) ";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    //共 13 欄
                    //項次  日期(DT) PLANDCARD 領班 領班姓名 小組長 小組長姓名 小組成員(EMPLYID) 成員姓名
                    //人(STAFF) 天(DURAION) 工時(STDHRS) 已報工時(ALS_HR_)
                    sheet1.Range[myfunc.GetExcelPos(0, i + 1)].Text = String.Format("{0:d}", i + 1);
                    if (!myfunc.checkisnull(dt.Rows[i]["DT"].ToString()))
                    { sheet1.Range[myfunc.GetExcelPos(1, i + 1)].Text = String.Format("{0:yyyy/MM/dd}", DateTime.Parse(dt.Rows[i]["DT"].ToString())); };
                    sheet1.Range[myfunc.GetExcelPos(2, i + 1)].Text = dt.Rows[i]["PLANNINGCARD"].ToString();
                    sheet1.Range[myfunc.GetExcelPos(3, i + 1)].Text = dt.Rows[i]["FOREMAN1"].ToString();
                    sheet1.Range[myfunc.GetExcelPos(4, i + 1)].Text = dt.Rows[i]["FOREMAN1_"].ToString();
                    sheet1.Range[myfunc.GetExcelPos(5, i + 1)].Text = dt.Rows[i]["LDMAN1"].ToString();
                    sheet1.Range[myfunc.GetExcelPos(6, i + 1)].Text = dt.Rows[i]["LDMAN1_"].ToString();
                    sheet1.Range[myfunc.GetExcelPos(7, i + 1)].Text = dt.Rows[i]["EMPLYID"].ToString();
                    sheet1.Range[myfunc.GetExcelPos(8, i + 1)].Text = dt.Rows[i]["EMPLYID_"].ToString();
                    sheet1.Range[myfunc.GetExcelPos(9, i + 1)].Text = dt.Rows[i]["STAFF"].ToString();
                    sheet1.Range[myfunc.GetExcelPos(10, i + 1)].Text = dt.Rows[i]["DURAION"].ToString();
                    sheet1.Range[myfunc.GetExcelPos(11, i + 1)].Text = dt.Rows[i]["STDHRS"].ToString();
                    sheet1.Range[myfunc.GetExcelPos(12, i + 1)].Text = dt.Rows[i]["ALS_HR_"].ToString();
                    
                    // end of for 
                }  // end of   for (int i = 0; i < dt.Rows.Count; i++)
                sheet1.AllocatedRange.AutoFitColumns();
                wk.SaveToStream(stream, FileFormat.Version2007);
            } //end of try
            catch (Exception e)
            {
                //Console.WriteLine(e);
                //throw;
                var Tmp_ErrMsg = e.Message;
                //包裝標籤檔產生完成
                Tmp_Str = "匯出檔案失敗<br>"
                                + Tmp_ErrMsg;
                MyCookie = new HttpCookie("EX_DFile", HttpUtility.UrlEncode(Tmp_Str));
                HttpContext.Current.Response.Cookies.Add(MyCookie);
                HttpContext.Current.ApplicationInstance.CompleteRequest();
                return;
            }
            finally
            {
                wk.Dispose();
            }

            //Tmp_Cnt = 6;
           //將檔案傳送至前端 & 加入 Cookie 訊息
            Tmp_Str = "已匯出完成!!  (" + Tmp_Cnt.ToString() + "筆) <br>"
                            + "檔案名稱(" + Tmp_FName + ")";
            MyCookie = new HttpCookie("EX_DFile", HttpUtility.UrlEncode(Tmp_Str));
            HttpContext.Current.Response.Cookies.Add(MyCookie);
            HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=\"" + HttpUtility.UrlEncode(fName, System.Text.Encoding.UTF8) + "\"");
            HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
            HttpContext.Current.Response.BinaryWrite(stream.ToArray());
            HttpContext.Current.Response.End();
        }    // end of ExportdFile


2022年10月21日 星期五

Email 用法說明 - MailMessage, SMTP - 附加檔案的用法: Attachments

目的:  Web  Email  用法說明

從 .Net2.0 開始, System.Net.Mail 命名空間提供開發者建立及傳送郵件訊息的相關方法。

  • MailMessage
    這個類別是用來建立電子郵件。支援簡單的純文字、HTML格式的電子郵件訊息、以及不同檢視方式、編碼標準及附加檔。
  • SmtpClient
    這個類別是用來寄送電子郵件。支援匿名網路連結、使用者驗證及SSL加密,另外也可以非同步寄送電子郵件,且允許使用者在寄送完成前取消寄送。

MailMessage 類別

MailMessage 的建構子

public MailMessage()
public MailMessage(string from,string to)
public MailMessage(string from,string to,string subject,string body)
public MailMessage(MailAddress from,MailAddress to)

MailMessage 的屬性

  • Subject :取得或設定這個電子郵件訊息的主旨
  • Body :取得或設定訊息主體。
  • IsBodyHtml :取得或設定值,指出郵件訊息主體是否採用 Html 格式。
  • From :寄件者。
  • To :收件者。
  • CC :副本收件者。
  • Bcc :密件副本收件者。
  • BodyEncoding :主體內容所用的編碼方式。
  • SubjectEncoding :主旨內容所用的編碼方式。
  • Attachments :取得附件集合。
  • AlternateViews :訊息主體的替代格式。

SmtpClient 類別

SmtpClient 的建構子

public SmtpClient();
public SmtpClient(string host);
public SmtpClient(string host, int port);

SmtpClient 的屬性

  • ClientCertificates :
  • EnableSsl :
  • Host :SMTP 交易的主機名稱或 IP 位址。
  • Port :SMTP 交易的連接埠。
  • Timeout : Send 呼叫逾時的時間。

SmtpClient 的方法

  • Send :傳送電子郵件訊息給 SMTP 伺服器進行傳遞。在傳送訊息時,會封鎖這些方法。
  • OnSendCompleted :引發 SendCompleted 事件。
  • SendAsync :傳送電子郵件訊息。 這些方法不會封鎖呼叫執行緒。
  • SendAsyncCancel :取消傳送電子郵件訊息的非同步作業。

範例一:示範建立 MailMessage 的相關方法

//建立一個MailMessage,同時指明 MailForm, MailTo, Subject, Body
MailMessage mail = new MailMessage ("jane@contoso.com", "ben@contoso.com", "Mail Subject", "Mail Body Test");

//寄件者, 收件者, 主旨, 本文內容
MailMessage mail = new MailMessage();
mail.From = new MailAddress("jane@contoso.com", "DisplayName"); //email, 顯示名稱

mail.To.Add(new MailAddress("ben.test@contoso.com", "ben test"));
mail.To.Add(new MailAddress("ben test<ben.test@contoso.com>"));     //使用角括弧,可使用一個參數同時包含顯示名稱和email 
mail.To.Add("ben test<ben.test@contoso.com>");                      //這樣使用也行。 but..中文..(請看下面注意說明)
            
mail.Subject = "Mail Subject";
mail.Body = "Mail Body Test";

//副本、密件副本
mail.CC.Add(new MailAddress("ben4@contoso.com", "ben4"));
mail.Bcc.Add(new MailAddress("ben3@contoso.com", "ben3"));

//DeliveryNotificationOptions:通知狀態 OnSuccess, OnFailure, Delay, None, Never
//ReplyTo:設定一個回覆地址
//Priority:設定電子郵件的優先順序

mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure | DeliveryNotificationOptions.OnSuccess;
mail.ReplyTo = new MailAddress("ben5@contoso.com", "ben5");
mail.Priority = MailPriority.High;

//html編碼  
mail.Body = "<html><body><h1>Picture</h1><br><img src=\"cid:Pic1\"></body></html>";
mail.IsBodyHtml = true;
mail.BodyEncoding = Encoding.UTF8; 

注意:若顯示名稱含中文時

當使用 mail.To.Add("ben test<ben.test@contoso.com>"); 這個方式加入email時,
若顯示名稱為中文時會產生錯誤,例如:mail.To.Add("測試<ben.test@contoso.com>"); 會跳出"指定字串不在電子郵件地址的必要表單中"的錯誤訊息.
只能使用這個方式 mail.To.Add(new MailAddress("測試<ben.test@contoso.com>"))
或將顯示名稱放在第二個參數
mail.To.Add(new MailAddress("ben.test@contoso.com", "測試"));

範例二:使用 SmtpClient 發送 MailMessage 的相關方法

SmtpClient client = new SmtpClient("smpt.gmail.com");   //建立 SMTP ,並指定 SMTP Server
client.Credentials = new System.Net.NetworkCredential("user", "pwd");   //驗證寄件者
client.EnableSsl = true;                                                //是否啟用 SSL
client.Port = 25;                                                       //指定 SMTP 交易連接埠
SendMail(client, mail);
//SmtpClient Smtp = new SmtpClient();   //建立SMTP連線  
//Smtp.Send(mail);   //發送

private void SendMail(SmtpClient client, MailMessage mail)
{
    try
    {
        client.Send(mail);  //寄送郵件
        MessageBox.Show("email send");
    }
    //Handle Mail Exceptions
    catch (InvalidOperationException exInvalidOperation)            //沒有指定 SMTP Server
    {
        MessageBox.Show(exInvalidOperation.Message.ToString());   
    }
    catch (SmtpFailedRecipientException exSmtpFailedRecipient)      //指定錯誤的收件者
    {
        MessageBox.Show(exSmtpFailedRecipient.Message.ToString());
    }
    catch (SmtpException exSmtp)                                    //找不到 SMTP 或 其他的例外錯誤
    {
        MessageBox.Show(exSmtp.Message.ToString());
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message.ToString());
    }
}

範例三:附加檔案

呼叫 MailMessage.Attachments 可取得附件的集合 AttachmentCollection 物件。 其組成項目為 Attachment 物件,可以透過該集合的 Add 方法加入新的項目。

MailMessage mailmessage = new MailMessage();

mailmessage.From = new MailAddress(txtMailFrom.Text);
mailmessage.To.Add(new MailAddress(txtMailTo.Text));
mailmessage.Subject = txtSubject.Text;
mailmessage.Body = txtBody.Text;
mailmessage.IsBodyHtml = cbHTML.Checked;

SmtpClient smtpclient = new SmtpClient(cbSMTP.Text);
smtpclient.Credentials = new System.Net.NetworkCredential(txtAccount.Text, txtPassword.Text);
smtpclient.EnableSsl = cbSSL.Checked;
smtpclient.Port = int.Parse(txtSmtpPort.Text);

string sFilePath = @"D:\MCTS\MCTS2011\Practice\Practice\bin\Debug\cloud.jpg";
Attachment attachment = new Attachment(sFilePath);
mailmessage.Attachments.Add(attachment);

SendMail(smtpclient, mailmessage);

Attachment 有好幾個建構子,其中一個包含一個 stream ,也就是可以將 stream 變成附件形式寄出。

// create SmtpClient
SmtpClient smtpclient = new SmtpClient(cbSMTP.Text);
smtpclient.Credentials = new System.Net.NetworkCredential(txtAccount.Text, txtPassword.Text);
smtpclient.EnableSsl = cbSSL.Checked;
smtpclient.Port = int.Parse(txtSmtpPort.Text);

// create Attachment
string sContent = "將資料流轉成附加檔案";
byte[] byteArray = Encoding.UTF8.GetBytes(sContent);
MemoryStream stream = new MemoryStream(byteArray);
Attachment attm = new Attachment(stream, "myfile.txt", MediaTypeNames.Text.Plain);

// create MailMessage
MailMessage mailmessage = new MailMessage();
mailmessage.From = new MailAddress(txtMailFrom.Text);
mailmessage.To.Add(new MailAddress(txtMailTo.Text));
mailmessage.Subject = txtSubject.Text;
mailmessage.Attachments.Add(attm);

// Send
SendMail(smtpclient, mailmessage);

範例四:指定不同格式的電子郵件

因應某些收件者無法顯示 HTML 內容,也可以同時提供純文字和 HTML 版本的郵件內容。

  • AlternateView 類別:用來建立不同格式的郵件複本。
  • MediaTypeNames 類別:指定郵件複本的媒體類型資訊。{Html,Plain,RichText,XML...}
// 設定一個HTML格式的 AlternateView 
string htmlBody = "<body><html>This message support <b>HTML</b></html></body>";
AlternateView viewHtml = AlternateView.CreateAlternateViewFromString(htmlBody, null, MediaTypeNames.Text.Html);
avHtml.LinkedResources.Add(pic1);

// 設定一個文字格式的 AlternateView
string textBody = "This message doesn't support HTML";
AlternateView viewPlain = AlternateView.CreateAlternateViewFromString(textBody, null, MediaTypeNames.Text.Plain);

// 使用 alternate views 加入訊息主體,替代 MailMessage.Body
mailmessage.AlternateViews.Add(viewHtml);
mailmessage.AlternateViews.Add(viewPlain);

SendMail(smtpclient, mailmessage);

範例五:內嵌檔案(1)

透過 LinkedResource 類別,可用來建立資源連結物件,並將該物件加入 Html 格式的 AlternateView 物件中。

給定每個 LinkedResource 一個唯一的 ContentId ,再將這個 ContentId 套用到 <img> 標籤的 cid 屬性的值。

// 設定連結資源檔
string sFilePath = @"D:\MCTS\MCTS2011\Practice\PracticeMCTS\bin\Debug\cloud.jpg";
LinkedResource resource1 = new LinkedResource(sFilePath, MediaTypeNames.Image.Jpeg);
resource1.ContentId = "resource_id_1";      //定義這個資源的 ContentID。

// 設定一個HTML格式的本文內容,並加入連結資源檔
string htmlBody = @"
<html><body>

<h1>資源內嵌</h1>
<img src=""cid:resource_id_1"" />

</body></html>";

AlternateView viewHtml = AlternateView.CreateAlternateViewFromString(htmlBody, null, MediaTypeNames.Text.Html);
viewHtml.LinkedResources.Add(resource1);

// 使用 alternate views 替代 MailMessage.Body
mailmessage.AlternateViews.Add(viewHtml);

SendMail(smtpclient, mailmessage);

範例六:內嵌檔案(2)

<img> 標籤中的 src 屬性,其值要等於 Attachment.Name 。

// 設定附件檔
string sFilePath2 = @"D:\MCTS\MCTS2011\Practice\PracticeMCTS\bin\Debug\cloud.jpg";
Attachment attm = new Attachment(sFilePath2);
attm.Name = Path.GetFileName(sFilePath2);
attm.NameEncoding = Encoding.GetEncoding("utf-8");
attm.TransferEncoding = TransferEncoding.Base64;

// 設定該附件為一個內嵌附件(Inline Attachment)
attm.ContentDisposition.Inline = true;                                      //附件中的內容是以內嵌方式呈現為電子郵件主體的一部分,則為 true
attm.ContentDisposition.DispositionType = DispositionTypeNames.Inline;      //附件類型 => 將附件顯示為電子郵件訊息主體的一部分
mailmessage.Attachments.Add(attm);

// 設定一個HTML格式的本文內容,並加入附件檔 
// img 標籤中的 src 屬性,其值要等於 Attachment.Name
string htmlBody = @"
<html><body>

<h3>附件內嵌(Inline Attachment)</h3>
<img src=""cloud.jpg"" />                       

</body></html>";
mailmessage.Body = htmlBody;

SendMail(smtpclient, mailmessage);

範例七:非同步傳送電子郵件

SmtpClient sc ;
private void btnSendAsync_Click(object sender, EventArgs e)
{
    MailMessage mail = new MailMessage();

    mail.From = new MailAddress(txtMailFrom.Text);
    mail.To.Add(new MailAddress(txtMailTo.Text));
    mail.Subject = txtSubject.Text;
    mail.Body = txtBody.Text;
    mail.IsBodyHtml = cbHTML.Checked;

    sc = new SmtpClient(cbSMTP.Text);
    sc.Credentials = new System.Net.NetworkCredential(txtAccount.Text, txtPassword.Text);
    sc.EnableSsl = cbSSL.Checked;
    sc.Port = int.Parse(txtSmtpPort.Text);

    string sFilePath = @"D:\MCTS\MCTS2011\Practice\Practice\bin\Debug\cloud.jpg";
    Attachment attm = new Attachment(sFilePath);
    mail.Attachments.Add(attm);

    sc.SendCompleted += new SendCompletedEventHandler(SendCompleted);
    sc.SendAsync(mail, null);
}

private void btnCancel_Click(object sender, EventArgs e)
{
    sc.SendAsyncCancel();
}

private void SendCompleted(object sender, AsyncCompletedEventArgs e)
{
    if (e.Cancelled)
        MessageBox.Show("Message Cancelled");
    else
    {
        if (e.Error != null)
            MessageBox.Show("Error : " + e.Error.ToString());
        else
            MessageBox.Show("Send Completed");
    }
}

2022年10月20日 星期四

V20107D - 顯示訊息, 中文字亂碼

 目的: V20107D - 顯示訊息, 中文字亂碼

處理說明:   1>顯示訊息:中文字亂碼
                         表示送出的中文字和 Browser(內碼不同)
                    2>Browser 中文字內碼(UTF-8)
                    3>儲存 *.js 的內碼為 UTF-8 即可