House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

How to "decode" e-mail subject ?

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Alright, ok :)
WebSite CFTalk
04/07/09 04:06 P
WebSite CFTalk wrote:
Paul Hastings
04/07/09 10:15 P
Thank you Paul
WebSite CFTalk
04/14/09 10:34 A
Alan Rother wrote:
Paul Hastings
04/07/09 10:09 P
>> Hi Paul,
Abid Islam
11/22/11 04:48 A
Thank you Paul,
WebSite CFTalk
04/08/09 04:54 A
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
WebSite CFTalk
04/07/2009 02:23 PM

I'm having trouble finding ways to convert a email subject from utf-8 to "plain text" Subject: (Copied from the mail header in outlook) =?utf-8?B?W1ZpZGVyZXNlbmR0IGZyYSBXUyBTdXBwb3J0XSBQYXlFeCDDuG5za2VyIGRl?= =?utf-8?B?ZyBnb2QgcMOlc2tl?= In Outlook this is translated to: [Videresendt fra WS Support] PayEx ønsker deg god påske Anyone care to show me how it's done? Thanks, Helge :)

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Alan Rother
04/07/2009 02:47 PM

This:B?W1ZpZGVyZXNlbmR0IGZyYSBXUyBTdXBwb3J0XSBQYXlFeCDDuG5za2VyIGRl?= =?utf-8?B?ZyBnb2QgcMOlc2tl?= Is not UTF8 encoding, this is some sort of Outlook "crap" UTF-8 Encoding is not an encryption schema, it's a file formatting encoding. It usually renders exactly as plain text. =] ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
WebSite CFTalk
04/07/2009 04:06 PM

Alright, ok :) But still, how do I convert it into something readable ? Helge :) This:B?W1ZpZGVyZXNlbmR0IGZyYSBXUyBTdXBwb3J0XSBQYXlFeCDDuG5za2VyIGRl?= =?utf-8?B?ZyBnb2QgcMOlc2tl?= Is not UTF8 encoding, this is some sort of Outlook "crap" UTF-8 Encoding is not an encryption schema, it's a file formatting encoding. It usually renders exactly as plain text. =] ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Paul Hastings
04/07/2009 10:15 PM

WebSite CFTalk wrote: > But still, how do I convert it into something readable ? <cfscript> y='W1ZpZGVyZXNlbmR0IGZyYSBXUyBTdXBwb3J0XSBQYXlFeCDDuG5za2VyIGRl'; x=toString(toBinary(y)); writeOutput(x); </cfscript> you should get something like: [Videresendt fra WS Support] PayEx ønsker de i'll leave parsing the MIME encoded subject to you...

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
WebSite CFTalk
04/14/2009 10:34 AM

Thank you Paul If anyone is interested: A bit "dirty" but this worked for me..: <cfset codedstring="=?utf-8?B?W1ZpZGVyZXNlbmR0IGZyYSBXUyBTdXBwb3J0XSBQYXlFeCDDuG5za2VyIGRl?= =?utf-8?B?ZyBnb2QgcMOlc2tl?="> <cfset cleanstring =""> <cfset a=#replacenocase(codedstring, '=?utf-8?B?','', 'all')#>   <cfloop list="#a#" index="lid" delimiters=" ">   <cfset cleanstring='#cleanstring#' & '#toString(toBinary(LID))#'>       </cfloop> <cfoutput>#cleanstring#</cfoutput> Helge WebSite CFTalk wrote: > But still, how do I convert it into something readable ? <cfscript> y='W1ZpZGVyZXNlbmR0IGZyYSBXUyBTdXBwb3J0XSBQYXlFeCDDuG5za2VyIGRl'; x=toString(toBinary(y)); writeOutput(x); </cfscript> you should get something like: [Videresendt fra WS Support] PayEx ønsker de i'll leave parsing the MIME encoded subject to you...

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Paul Vernon
04/07/2009 11:26 PM

> This:B?W1ZpZGVyZXNlbmR0IGZyYSBXUyBTdXBwb3J0XSBQYXlFeCDDuG5za2VyIGRl?= >  =?utf-8?B?ZyBnb2QgcMOlc2tl?= > I missed something... It's not quoted printable, it's binary encoded. Q for quoted-printable and B for binary. You need to look for =?B? Or =?Q? At the beginning of the string. If its =?B? Then take everything between =?B? and ?= and base64 decode it. W1ZpZGVyZXNlbmR0IGZyYSBXUyBTdXBwb3J0XSBQYXlFeCDDuG5za2VyIGRl decodes as [Videresendt fra WS Support] PayEx ønsker de ZyBnb2QgcMOlc2tl decodes as g god påske To handle all eventualities, you will still need a quoted-printable decoder to handle subjects that start with =?Q?

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Paul Hastings
04/07/2009 10:09 PM

Alan Rother wrote: > This:B?W1ZpZGVyZXNlbmR0IGZyYSBXUyBTdXBwb3J0XSBQYXlFeCDDuG5za2VyIGRl?= >  =?utf-8?B?ZyBnb2QgcMOlc2tl?= > > Is not UTF8 encoding, this is some sort of Outlook "crap" no, it's not outlook "crap". that's MIME encoding: "=?charset?encoding?encoded text?=" so that subject text is in utf-8 using base64 encoding (the ?B? bit). > UTF-8 Encoding is not an encryption schema, it's a file formatting encoding. and no, utf-8 is not "a file formatting encoding".

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Paul Vernon
04/07/2009 11:18 PM

----- Excess quoted text cut - see Original Post for more ----- Actually, it isn't Outlook "crap" it is standards compliant RFC Quoted-printable content and the utf-8 info is telling you that the quoted printable text once decoded will be in the utf-8 encoding and should be treated as such. It is done in this way so it can be sent to mail systems that still have to support 7-bit encoding mechanisms. You'll need to look at finding a Quoted-Printable decoder for CF. I have one built into my CFX tags but they are written in Delphi so not really much help for you at the moment. Paul

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Abid Islam
11/22/2011 04:48 AM

>> Hi Paul, I am working in delphi 7, and I am done with utf-8?B? decoding, now i need to decode utf-8?Q? Please provide me the code for decoder in Delphi. thanks in advance ----- Excess quoted text cut - see Original Post for more -----

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
WebSite CFTalk
04/08/2009 04:54 AM

Thank you Paul, That gave me something to work on. Helge > This:B?W1ZpZGVyZXNlbmR0IGZyYSBXUyBTdXBwb3J0XSBQYXlFeCDDuG5za2VyIGRl?= >  =?utf-8?B?ZyBnb2QgcMOlc2tl?= > I missed something... It's not quoted printable, it's binary encoded. Q for quoted-printable and B for binary. You need to look for =?B? Or =?Q? At the beginning of the string. If its =?B? Then take everything between =?B? and ?= and base64 decode it. W1ZpZGVyZXNlbmR0IGZyYSBXUyBTdXBwb3J0XSBQYXlFeCDDuG5za2VyIGRl decodes as [Videresendt fra WS Support] PayEx ønsker de ZyBnb2QgcMOlc2tl decodes as g god påske To handle all eventualities, you will still need a quoted-printable decoder to handle subjects that start with =?Q?


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 20, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference