quoted printable encoding

Discussion for developers using MailEnable.
Post Reply
cbdigitalmovie
Posts: 10
Joined: Sun Jun 13, 2004 10:12 pm

quoted printable encoding

Post by cbdigitalmovie » Sun Jun 13, 2004 10:16 pm

hi,

while getting used to the program and adjusting our newsletter scripts to the new program, i found out that dropping the message directly to the outbound is the fastest... but it requires to pre-encode all data, so i look for a quoted printable encoding everywhere... and found out i had to write it. now i think it might be good to have it out so others can use it.

so here it is. remarks are in german, which should not matter, it runs and encodes any string (or message) to quoted printable. :D



function QPencode(byval eingabe)
dim zeile
dim ausgabe
dim neuzeile
dim zeichen
dim ascii
dim i
dim j

ausgabe = ""
zeile = split (eingabe, vbnewline) ' Eingabe in Zeilen splitten

for i = lbound(zeile) to ubound (zeile) ' alle Zeilen durchlaufen

neuzeile = ""

for j = 1 to len(zeile(i))

zeichen = mid(zeile(i), j, 1)
ascii = asc(zeichen)
if (ascii < 32) or (ascii = 61) or (ascii > 126) then
zeichen = "=" & ucase(cstr(hex(ascii)))
end if
if len(neuzeile) + len(zeichen) >= 76 then ' wenn die neue Zeile zu lang würde...
ausgabe = ausgabe & neuzeile & "=" & vbnewline
neuzeile = ""
end if

neuzeile = neuzeile & zeichen

next ' j ' nächstes Zeichen

ausgabe = ausgabe & neuzeile & vbnewline

next ' i ' nächste Zeile

QPencode = ausgabe
end function

btw this is asp with vbscript of course...

chris

MrByte
Posts: 663
Joined: Tue Nov 11, 2003 5:33 pm
Location: Florida, USA

Post by MrByte » Mon Jun 14, 2004 2:01 am

Great few lines that surely are going to help others here!
Vielen Dank!
.MrByte

cbdigitalmovie
Posts: 10
Joined: Sun Jun 13, 2004 10:12 pm

Post by cbdigitalmovie » Mon Jun 14, 2004 6:27 pm

no problem, you´re welcome. :-)

chris

Mitesh
Posts: 3
Joined: Mon Dec 17, 2018 6:33 am

Re: quoted printable encoding

Post by Mitesh » Wed Feb 13, 2019 1:21 pm

My quoted printable encoding function is not matching with the actual body which is present in my .MAI file.
The issues are related to spaces and next line

Mitesh
Posts: 3
Joined: Mon Dec 17, 2018 6:33 am

Re: quoted printable encoding

Post by Mitesh » Thu Feb 14, 2019 8:41 am

Please Let me know if anyone had find the solution of above query.
Thanks in Advance

Post Reply