parseQuotedPrintable(text)
Last updated January 10, 2007
Version: 1 | Requires: CF6 | Library: StrLib
Description:
Allows a string which is encoded with the Quoted-Printable format to be converted into UTF-8 for parsing various document formats such as vCard and iCal.
Return Values:
Returns a string.
Example:
<cfoutput>#ParseQuotedPrintable("1=3D1")#</cfoutput>
Parameters:
Name | Description | Required |
---|---|---|
text | String to parse. | Yes |
Full UDF Source:
<!---
Converts a string of text from Quoted-Printable format to UTF-8.
@param text String to parse. (Required)
@return Returns a string.
@author Isaac Dealey (info@turnkey.to)
@version 1, January 10, 2007
--->
<cffunction name="parseQuotedPrintable" output="false">
<cfargument name="text" type="string" required="true">
<cfset var crlf = chr(13) & chr(10)>
<cfset var char = "">
<cfset var x = 0>
<cfset text = ListToArray(crlf & text,"=")>
<cfloop index="x" from="1" to="#arrayLen(text)#">
<cfset char = left(text[x],2)>
<cfset text[x] = removechars(text[x],1,2)>
<cfif char is not crlf>
<cfset text[x] = CHR(InputBaseN(char, 16)) & text[x]>
</cfif>
</cfloop>
<cfreturn ArrayToList(text,"")>
</cffunction>
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016