Print this page

How validation rules work with regards to foreign (Thai) characters with accents.

Knowledge Article Number 000213861

Why is validation rule using REGEX unable to validate Thai (Siamese) characters?

Note: This is only happening on Thai characters (with accent). Other characters like Japanese and Chinese works perfectly fine.

Resolution Thai language has it's own Unicode block containing characters for the Thai, Lanna Tai, and Pali languages. It is based on the Thai Industrial Standards 620-2529 and 620-2533

Validation rules that uses "Regular Expressions" uses the "Java Platform Se 6 Syntax) which is different from Thai Unicode Block.

In order to understand this more easily follow these steps to reproduce:

1. Create a new contact with English alphabets: Validation rule will not fire and the record will be saved
2. Create a new contact with Thai characters without accents: Validation rule will not fire and the record will be saved
3. Create a new contact with English special characters: 
Validation rule will fire and the record will not save. (Expected behavior)

Hence, validation rule with this formula: 
REGEX(FirstName, "[\\p{L}\\s'-]*$")  is working fine.
Sample Validation Rule

NOT( REGEX(FirstName, "[\\p{L}\\s'-]*$") )

However, when you: 

1. Create new contact with Thai characters with accents: Validation rule will fire and record will not save.

Characters without accents: ฃ ขวด
Characters with accents: ช ช้าง

The expected behavior here is users should be able to save a new contact even if they enter Thai characters with accents. But they were also treated as special characters using that formula.

But since Thai language has its own Unicode block, validation rule formula will need revision to 

REGEX(FirstName, "[\\p{L}\\p{InThai}\\s'-]*$"). 

Thai characters with accents can be successfully saved and will not be treated by the formula as special characters.

Note that this behavior can potentially happen with any other character with accent. So any language with accent encountering this issue can have similar solution applied.

promote demote