Created
June 14, 2019 15:04
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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