Skip to content

Instantly share code, notes, and snippets.

@JamoCA
Created June 14, 2019 15:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamoCA/c837e62c0b0162cbb5f65ea4d3d6b96d to your computer and use it in GitHub Desktop.
Save JamoCA/c837e62c0b0162cbb5f65ea4d3d6b96d to your computer and use it in GitHub Desktop.
ColdFusion script to normalize UTF characters by combining character sequences into a single character
<cfscript>
/* NFKC: UTF Compatibility Decomposition, followed by Canonical Composition */
/* Recommend using Junidecode https://gist.github.com/JamoCA/6565bd4e2526b7c177a5f0cde3980d1c */
function normalizeUTF(inputString){
var normalizer = createObject( "java", "java.text.Normalizer" );
var normalizerForm = createObject( "java", "java.text.Normalizer$Form" );
return normalizer.normalize( javaCast( "string", arguments.inputString ), normalizerForm.NFKC );
}
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment