Base64 Encoding Fun
And now for some encoding fun :P
The most common encoding that I like to use is Base64 Encode. Over the past 1 years plus, this encoding have proved to be very useful and I shall some tricks and tips that I discover! For fun with online base64 encode or decode check this site out.
1) Base64 encoding and decoding is dependent on the language charset that you set in. For example if you are encoding in a page with iso-8859-1 and a utf-8, the result encoding is different. I believed this is due to the different byte used and the character set used in the encoding.
2) Base64 encoding is useful to hide away clear text message.
3) My most important topic here! Base64 encoding can used in email subject and content. While working with mult-lingual email. the challenge is always to get the correct character displayed with showing gibberish stuffs. For my experiments before, I found out that base64 encode subject line are more reliable than quote-text for double-byte language email.
Due to the various different sytems operating in their settings and configuration, when a double-byte mail subject is quote-text, the result maybe displayed incorrectly. On some machine, it might displayed as you wanted, but not for some especially for those web-based email viewed online!
To send out double-byte character email ,the provided CDONTS and CDOSYS system on Microsoft Windows platform needs you to set the correct Session Codepage and encode the mail subject using quote-texted. When checked the reference, both the CDONTS and CDOSYS does not allow the mail subject to be base64 encoded! So for those mail subject that I received and does not appear correctly, how do we tackle this problem? One way you can do is change the subject liner to some other content. But what if the client insisted on it?
My solution that I discovered that it worked.ie: =?gb2312?b?xxxxxSubject-base64xxxxx==?=
Example with ASP using CDONTS
<%'Create the e-mail server object
%>
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon
With objCDOSYSMail
.From = strEmail
.To = strFriendEmail
.Subject = "=?gb2312?b?" & strSubject & "==?="
End With ' objCDOSYSMail
2 Comments:
Hi I tried ur method for the subject title but it doesnt work...
Hi I tried ur method for the subject title but it doesnt work...
Post a Comment
<< Home