Search code examples
coldfusioncoldfusion-8

Find non-ascii characters in string


?testMSG=ÁáÉéÍíÑñÓóÚúÜü«»¿¡€

<cfset ascii = NOT REFind('[\u0080-\uFFFF]', arguments.textMSG)>

Variable ascii returns 1, which shouldn't be. REFind('[\u0080-\uFFFF]', arguments.textMSG) itself returns 0 despite textMSG containing characters above 128. The line itself is inside a remote cffunction.


Solution

  • As per the docs, ColdFusion's regex implementation doesn't support the \u escape sequence (and, indeed, I am fairly certain it's completely unaware of the concept of unicode).

    To do what you want here, you're gonna have to use Java regexes.