Alex
Alex

Reputation: 2259

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.

Upvotes: 0

Views: 626

Answers (1)

Adam Cameron
Adam Cameron

Reputation: 29870

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.

Upvotes: 1

Related Questions