iso88591(string)
Last updated January 10, 2007
Version: 1 | Requires: CF6 | Library: StrLib
Description:
Parses any string into iso-8859-1 codification.
Return Values:
Returns a string.
Example:
<cfset myvar = "Traducci�n : �,�,� �ato">
<cfset myvar = iso88591(myvar)>
<cfoutput>#myvar#</cfoutput>
The output is : "Traducción : Á, É, Í Ñato".
Parameters:
Name | Description | Required |
---|---|---|
string | String to parse. | Yes |
Full UDF Source:
<!---
Parses any string into iso-8859-1 codification.
Raymond Camden modified it for bug fixes.
@param string String to parse. (Required)
@return Returns a string.
@author Erick Rodriguez (tb.erick.rodriguez@gmail.com)
@version 1, January 10, 2007
--->
<cffunction name="iso88591" access="private" returntype="string">
<cfargument name="string" type="string" required="yes">
<cfset var result = arguments.string>
<cfset var x = "">
<cfset var i = "">
<cfscript>
x = arraynew(1);
for(i=1;i lte 255;i = i + 1){
x[i]=false;
}
x[34]=""";
x[38]="&";
x[160]=" ";
x[161]="¡";
x[162]="¢";
x[163]="£";
x[164]="¤";
x[165]="¥";
x[166]="¦";
x[167]="§";
x[168]="¨";
x[169]="©";
x[170]="ª";
x[171]="«";
x[172]="¬";
x[173]="­";
x[174]="®";
x[175]="¯";
x[176]="°";
x[177]="±";
x[178]="²";
x[179]="³";
x[180]="´";
x[181]="µ";
x[182]="¶";
x[183]="·";
x[184]="¸";
x[185]="¹";
x[186]="º";
x[187]="»";
x[188]="¼";
x[189]="½";
x[190]="¾";
x[191]="¿";
x[192]="À";
x[193]="Á";
x[194]="Â";
x[195]="Ã";
x[196]="Ä";
x[197]="Å";
x[198]="Æ";
x[199]="Ç";
x[200]="È";
x[201]="É";
x[202]="Ê";
x[203]="Ë";
x[204]="Ì";
x[205]="Í";
x[206]="Î";
x[207]="Ï";
x[208]="Ð";
x[209]="Ñ";
x[210]="Ò";
x[211]="Ó";
x[212]="Ô";
x[213]="Õ";
x[214]="Ö";
x[215]="×";
x[216]="Ø";
x[217]="Ù";
x[218]="Ú";
x[219]="Û";
x[220]="Ü";
x[221]="Ý";
x[222]="Þ";
x[223]="ß";
x[224]="à";
x[225]="á";
x[226]="â";
x[227]="ã";
x[228]="ä";
x[229]="å";
x[230]="æ";
x[231]="ç";
x[232]="è";
x[233]="é";
x[234]="ê";
x[235]="ë";
x[236]="ì";
x[237]="í";
x[238]="î";
x[239]="ï";
x[240]="ð";
x[241]="ñ";
x[242]="ò";
x[243]="ó";
x[244]="ô";
x[245]="õ";
x[246]="ö";
x[247]="÷";
x[248]="ø";
x[249]="ù";
x[250]="ú";
x[251]="û";
x[252]="ü";
x[253]="ý";
x[254]="þ";
x[255]="ÿ";
for(i=1;i lte 255;i=i+1) {
if(x[i] neq false) result = replace(result,chr(i),x[i],"all");
}
</cfscript>
<cfreturn result>
</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