Skip to content

Instantly share code, notes, and snippets.

@Tropicalista
Created November 28, 2015 23:10
Show Gist options
  • Save Tropicalista/25ef1499ea85058712f7 to your computer and use it in GitHub Desktop.
Save Tropicalista/25ef1499ea85058712f7 to your computer and use it in GitHub Desktop.
Accented chars converted in coldfusion
<cfscript>
k = "á,é,í,ó,ú,ý,à,è,ì,ò,ù,â,ê,î,ô,û,ã,ñ,õ,ä,ë,ï,ö,ü,ÿ,À,È,Ì,Ò,Ù,Á,É,Í,Ó,Ú,Ý,Â,Ê,Î,Ô,Û,Ã,Ñ,Õ,Ä,Ë,Ï,Ö,Ü";
k = createObject( 'java', 'java.text.Normalizer' ).normalize( k, createObject( 'java', 'java.text.Normalizer$Form' ).valueOf('NFD') ).replaceAll('\p{InCombiningDiacriticalMarks}+','').replaceAll('[^\p{ASCII}]+','');
writeOutput(k);
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment