|
See it online at Quoted-printable encoder sample page.
This article contains a short function for quoted printable encoding, using CDO.Message object.
You can use this function in ASP or .VBS files (wsh - windows scripting host files), or
directly in VBA (visual basic 5, 6, Word, Excel, Access and Outlook scripting).
A source data of this function is a String variable and charset parameter of destination data.
The source string (16bit VBScript BSTR variable) is first converted to a destination charset,
using ADODB.Stream (GetDecodedContentStream).
If the destination charset is not specified, the ADODB.Stream uses "iso-8859-1" by default.
The EncodedContentStream then converts the binary data to a Quoted-Printable output string.
Quoted-printableFrom Wikipedia, the free encyclopedia.Quoted-printable is an encoding using printable characters, alphanumeric and the equals sign "=", to transmit 8bit data over a 7bit data path. It is defined as a MIME content transfer encoding for use in Internet e-mail. [edit]
IntroductionThe basic Internet e-mail transmission protocol, SMTP, supports only ASCII characters (see also 8BITMIME). MIME defines mechanisms for sending other kinds of information in e-mail, including text in languages other than English using character encodings other than ASCII. However these encodings often use byte values outside the ASCII range so they need to be encoded further before they are suitable for use in e-mail. Quoted-printable encoding is one method used for mapping arbitary bytes into sequences of ASCII characters. This encoding is reversible, meaning the original bytes and hence the non-ASCII characters they represent can be recovered. Quoted-printable and Base64 are the two basic MIME content transfer encodings. If the input text is mostly ASCII, quoted-printable results in a fairly readable and compact encoded result. On the other hand if the input is not mostly ASCII then quoted printable becomes both unreadable and extremely inefficient. Base64 is not readable but has a predictable overhead for all data and is the more sensible choice for binary formats or text in non latin based languages. [edit]
Quoted Printable EncodingAny 8-bit byte value may be encoded with 3 characters, an "=" followed by two hexadecimal digits (0-9 or A-F) representing the byte's numeric value. For example, a US-ASCII form feed character (decimal value 12) can be represented by "=0C", and a US-ASCII equal sign (decimal value 61) is represented by "=3D". All characters except printable ASCII characters or end of line characters must be encoded in this fashion. Printable ASCII characters except "=", i.e. those with decimal values between 33 and 126 excepting decimal value 61 (=), may be represented by themselves. ASCII tab and space characters, decimal values 9 and 32, may be represented by themselves except if these characters appear at the end of a line. If one of these characters appears at the end of a line it must be encoded as "=09" (tab) or "=20" (space). If the data being encoded contains meaningful line breaks, they must be encoded as an ASCII CR LF sequence, not as their original byte values. Conversely if byte values 10 and 13 have meanings other than end of line then they must be encoded as =0A and =0D. Lines of quoted-printable encoded data must not be longer than 76 characters. To satisfy this requirement without altering the encoded text soft line breaks may be added as desired. A soft line break consists of an "=" at the end of an encoded line and does not cause a line break in the decoded text. See alsofor 'Quoted-printable encode VBScript function.' article Quoted-printable decode VBScript function.This article contains a short function for quoted printable decoding, using CDO.Message object.Base64 encode VBS function (vb encoder algorithm), source codeSource of VBS (ASP) function that lets you encode source data (binary or string) to a base64 encoded string. Base64 decode VBS function (vb decoder algorithm), source codeSource of VBS (ASP) function that enables decode base64 encoded strings. Copyright and use this code
The source code on this page and other samples at https://www.motobit.com/tips/
are a free code, you can use it as you want: copy it, modify it, use it in your products, ...
If you use this code, please:
1. Leave the author note in the source.
or
2. Link this sample from you page.
<A Href="https://www.motobit.com/tips/detpg_quoted-printable-encode/" Title="This article contains a short function for quoted printable encoding, using CDO.Message object." >Quoted-printable encode VBScript function.</A> Do you like it? Rate me on LinkedIn |
© 1996 - 2019 Antonin Foller, Motobit Software | About, Contacts