You need to sign in to do that
Don't have an account?
Laxman Vattam
recognising non utf-8 characters
I need to write a trigger to recognise non UTF-8 characters entered into name field of account and set some custom flag when user enters non UTF-8 characters. I started with below sample testing logic but it doesnt work. I always get the output as 'Non Match' in the below example. Please guide me on what is missing here. Open for alternate solutions as well.
Note: I just started with alphabets and numbers but need to change the logic to identify all UTF-8 characters
Note: I just started with alphabets and numbers but need to change the logic to identify all UTF-8 characters
String FirstName = 'Fred'; Pattern regexPattern = Pattern.compile('[a-zA-Z_0-9]'); Matcher regexMatcher = regexPattern.matcher(FirstName); if (!regexMatcher.matches()) { System.debug(LoggingLevel.Debug, 'No Matches'); } else { System.debug(LoggingLevel.Debug, 'Matches'); }